你好,我的服务人员有哈希不匹配问题,我想是facebook导致了这个错误。我有疑问:
发布于 2021-12-19 13:34:22
好的,散列不匹配manifest.webmanifest。问题是我们为什么会有这个错误?什么是哈希?散列意味着将文本散列到有限的随机字符。它可以是一小段文字或一本书,这一点很重要。所有这些都变成了这样的随机特征:556dbd80aaaa6096e48da8e49505e6953991ce81
,现在我的清单看起来如下:
{
"name": "reader-web",
"short_name": "reader-web",
"theme_color": "#1976d2",
"background_color": "#fafafa",
"display": "standalone",
"scope": "./",
"start_url": "./",
"icons": [
{
"src": "assets/icons/icon-72x72.png",
"sizes": "72x72",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "assets/icons/icon-96x96.png",
"sizes": "96x96",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "assets/icons/icon-128x128.png",
"sizes": "128x128",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "assets/icons/icon-144x144.png",
"sizes": "144x144",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "assets/icons/icon-152x152.png",
"sizes": "152x152",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "assets/icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "assets/icons/icon-384x384.png",
"sizes": "384x384",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "assets/icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable any"
}
]
}
它为这些556dbd80aaaa6096e48da8e49505e6953991ce81
提供了一个散列。在我的MICROSOFT windows 10计算机上有这些散列。好的,我们通过GIT将该文件推送到服务器,然后服务器将其提供给客户端。客户犯了错误:
Debug log:
[23m49s182u] TypeError(Failed to fetch, TypeError: Failed to fetch
at Driver.safeFetch (https://awread.vn/ngsw-worker.js:2796:41)
at Driver.handleFetch (https://awread.vn/ngsw-worker.js:2240:33)) Driver.fetch(https://www.facebook.com/tr/?id=178697176886410&ev=fb_page_view&dl=https%3A%2F%2Fawread.vn%2F&rl=&if=false&ts=1639919002667&sw=1920&sh=1080&at=)
[23m48s718u] Error(Hash mismatch (cacheBustedFetchFromNetwork): https://awread.vn/manifest.webmanifest: expected 556dbd80aaaa6096e48da8e49505e6953991ce81, got bc11265797cbb7d7676a8e9838d3808c53a9cb32 (after cache busting), Error: Hash mismatch (cacheBustedFetchFromNetwork): https://awread.vn/manifest.webmanifest: expected 556dbd80aaaa6096e48da8e49505e6953991ce81, got bc11265797cbb7d7676a8e9838d3808c53a9cb32 (after cache busting)
at PrefetchAssetGroup.cacheBustedFetchFromNetwork (https://awread.vn/ngsw-worker.js:759:35)
at async PrefetchAssetGroup.fetchFromNetwork (https://awread.vn/ngsw-worker.js:695:25)
at async PrefetchAssetGroup.fetchAndCacheOnce (https://awread.vn/ngsw-worker.js:658:29)
at async PrefetchAssetGroup.handleFetch (https://awread.vn/ngsw-worker.js:514:29)
at async https://awread.vn/ngsw-worker.js:1484:30
at async AppVersion.handleFetch (https://awread.vn/ngsw-worker.js:1481:27)
at async Driver.handleFetch (https://awread.vn/ngsw-worker.js:2221:31)) Driver.handleFetch(version: a38f1134bbce491571e14f75adc9ef27a23b4437)
等等..。为什么?我们需要556dbd80aaaa6096e48da8e49505e6953991ce81
但我们有bc11265797cbb7d7676a8e9838d3808c53a9cb32
?检查服务器上的manifest.webmanifest:sha1sum manifest.webmanifest
,我们得到了bc11265797cbb7d7676a8e9838d3808c53a9cb32
谁来改变它?因为建造步骤?是什么东西修改了那个文件导致了那个错误?不..。因为git系统。经过10个小时的调试后,请按照此回答。我发现了这个:https://stackoverflow.com/a/62935101/5748537
默认情况下,git替换行尾,这导致服务器上的文件与原始文件不同,它们的散列也不同。
所以我们用git config --local core.autocrlf false
来改变它,然后我们就完成了!
https://stackoverflow.com/questions/70411832
复制相似问题