@strapi/provider-upload-local 4.3.2 → 4.3.5
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/index.js +5 -4
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -15,7 +15,7 @@ const UPLOADS_FOLDER_NAME = 'uploads';
|
|
|
15
15
|
|
|
16
16
|
module.exports = {
|
|
17
17
|
init({ sizeLimit = 1000000 } = {}) {
|
|
18
|
-
const verifySize = file => {
|
|
18
|
+
const verifySize = (file) => {
|
|
19
19
|
if (file.size > sizeLimit) {
|
|
20
20
|
throw new PayloadTooLargeError();
|
|
21
21
|
}
|
|
@@ -37,7 +37,7 @@ module.exports = {
|
|
|
37
37
|
pipeline(
|
|
38
38
|
file.stream,
|
|
39
39
|
fs.createWriteStream(path.join(uploadPath, `${file.hash}${file.ext}`)),
|
|
40
|
-
err => {
|
|
40
|
+
(err) => {
|
|
41
41
|
if (err) {
|
|
42
42
|
return reject(err);
|
|
43
43
|
}
|
|
@@ -54,7 +54,7 @@ module.exports = {
|
|
|
54
54
|
|
|
55
55
|
return new Promise((resolve, reject) => {
|
|
56
56
|
// write file in public/assets folder
|
|
57
|
-
fs.writeFile(path.join(uploadPath, `${file.hash}${file.ext}`), file.buffer, err => {
|
|
57
|
+
fs.writeFile(path.join(uploadPath, `${file.hash}${file.ext}`), file.buffer, (err) => {
|
|
58
58
|
if (err) {
|
|
59
59
|
return reject(err);
|
|
60
60
|
}
|
|
@@ -70,11 +70,12 @@ module.exports = {
|
|
|
70
70
|
const filePath = path.join(uploadPath, `${file.hash}${file.ext}`);
|
|
71
71
|
|
|
72
72
|
if (!fs.existsSync(filePath)) {
|
|
73
|
+
// eslint-disable-next-line no-promise-executor-return
|
|
73
74
|
return resolve("File doesn't exist");
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
// remove file from public/assets folder
|
|
77
|
-
fs.unlink(filePath, err => {
|
|
78
|
+
fs.unlink(filePath, (err) => {
|
|
78
79
|
if (err) {
|
|
79
80
|
return reject(err);
|
|
80
81
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/provider-upload-local",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.5",
|
|
4
4
|
"description": "Local provider for strapi upload",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"upload",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"test": "echo \"no tests yet\""
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@strapi/utils": "4.3.
|
|
38
|
+
"@strapi/utils": "4.3.5",
|
|
39
39
|
"fs-extra": "10.0.0"
|
|
40
40
|
},
|
|
41
41
|
"engines": {
|
|
42
42
|
"node": ">=14.19.1 <=16.x.x",
|
|
43
43
|
"npm": ">=6.0.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "a52b0535513ff35b4ef46c9daf7be48f2ba71737"
|
|
46
46
|
}
|