@sanity/export 2.30.3-shopify.3 → 2.30.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AssetHandler.js +6 -7
- package/package.json +2 -2
- package/src/AssetHandler.js +8 -8
package/lib/AssetHandler.js
CHANGED
|
@@ -292,14 +292,13 @@ class AssetHandler {
|
|
|
292
292
|
var remoteSha1 = stream.headers['x-sanity-sha1'];
|
|
293
293
|
var remoteMd5 = stream.headers['x-sanity-md5'];
|
|
294
294
|
var hasHash = Boolean(remoteSha1 || remoteMd5);
|
|
295
|
-
var method =
|
|
296
|
-
|
|
295
|
+
var method = sha1 ? 'sha1' : 'md5'; // Asset validity is primarily determined by the sha1 hash. However, the sha1 hash is computed
|
|
296
|
+
// before certain processes (i.e. svg sanitization) which can result in a different hash.
|
|
297
|
+
// When the sha1 hashes don't match, fallback to using the md5 hash.
|
|
297
298
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
differs = remoteSha1 !== sha1;
|
|
302
|
-
}
|
|
299
|
+
var sha1Differs = remoteSha1 && sha1 !== remoteSha1;
|
|
300
|
+
var md5Differs = remoteMd5 && md5 !== remoteMd5;
|
|
301
|
+
var differs = sha1Differs && md5Differs;
|
|
303
302
|
|
|
304
303
|
if (differs && attemptNum < 3) {
|
|
305
304
|
debug('%s does not match downloaded asset, retrying (#%d) [%s]', method, attemptNum + 1, url);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/export",
|
|
3
|
-
"version": "2.30.3
|
|
3
|
+
"version": "2.30.3",
|
|
4
4
|
"description": "Export Sanity documents and assets",
|
|
5
5
|
"main": "lib/export.js",
|
|
6
6
|
"engines": {
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"url": "https://github.com/sanity-io/sanity/issues"
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://www.sanity.io/",
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "78ec08868a5da69946759f298d9cd71a11bd0e8d"
|
|
53
53
|
}
|
package/src/AssetHandler.js
CHANGED
|
@@ -167,14 +167,14 @@ class AssetHandler {
|
|
|
167
167
|
const remoteSha1 = stream.headers['x-sanity-sha1']
|
|
168
168
|
const remoteMd5 = stream.headers['x-sanity-md5']
|
|
169
169
|
const hasHash = Boolean(remoteSha1 || remoteMd5)
|
|
170
|
-
const method =
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
170
|
+
const method = sha1 ? 'sha1' : 'md5'
|
|
171
|
+
|
|
172
|
+
// Asset validity is primarily determined by the sha1 hash. However, the sha1 hash is computed
|
|
173
|
+
// before certain processes (i.e. svg sanitization) which can result in a different hash.
|
|
174
|
+
// When the sha1 hashes don't match, fallback to using the md5 hash.
|
|
175
|
+
const sha1Differs = remoteSha1 && sha1 !== remoteSha1
|
|
176
|
+
const md5Differs = remoteMd5 && md5 !== remoteMd5
|
|
177
|
+
const differs = sha1Differs && md5Differs
|
|
178
178
|
|
|
179
179
|
if (differs && attemptNum < 3) {
|
|
180
180
|
debug('%s does not match downloaded asset, retrying (#%d) [%s]', method, attemptNum + 1, url)
|