@nexrender/core 1.51.0 → 1.51.2
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/package.json +2 -2
- package/src/tasks/download.js +3 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexrender/core",
|
|
3
|
-
"version": "1.51.
|
|
3
|
+
"version": "1.51.2",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"author": "Inlife",
|
|
6
6
|
"homepage": "https://www.nexrender.com",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "02fbfff977eb0b0d5b662de0dec37d7ed3899981"
|
|
42
42
|
}
|
package/src/tasks/download.js
CHANGED
|
@@ -25,10 +25,8 @@ const download = (job, settings, asset) => {
|
|
|
25
25
|
/* ^ remove possible query search string params ^ */
|
|
26
26
|
destName = decodeURI(destName) /* < remove/decode any special URI symbols within filename */
|
|
27
27
|
|
|
28
|
-
/* prevent
|
|
29
|
-
|
|
30
|
-
destName = Math.random().toString(36).substring(2) + path.extname(asset.src).split('?')[0];
|
|
31
|
-
}
|
|
28
|
+
/* prevent duplicate filename collisions during parallel fetch */
|
|
29
|
+
destName = Math.random().toString(36).substring(2) + '-' + destName;
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
/* force asset name if it is provided */
|
|
@@ -86,7 +84,7 @@ const download = (job, settings, asset) => {
|
|
|
86
84
|
/* TODO: maybe move to external package ?? */
|
|
87
85
|
const src = asset.src
|
|
88
86
|
return fetch(src, asset.params)
|
|
89
|
-
.then(res => res.ok ? res : Promise.reject(
|
|
87
|
+
.then(res => res.ok ? res : Promise.reject(new Error(`Unable to download file ${src}`)))
|
|
90
88
|
.then(res => {
|
|
91
89
|
// Set a file extension based on content-type header if not already set
|
|
92
90
|
if (!asset.extension) {
|