@strapi/provider-upload-local 4.0.0-beta.2 → 4.0.0-beta.6

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.
Files changed (2) hide show
  1. package/lib/index.js +3 -7
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -16,12 +16,8 @@ module.exports = {
16
16
  throw errors.entityTooLarge();
17
17
  }
18
18
  };
19
- const configPublicPath = strapi.config.get(
20
- 'middleware.settings.public.path',
21
- strapi.config.paths.static
22
- );
23
19
 
24
- const uploadDir = path.resolve(strapi.dirs.root, configPublicPath);
20
+ const publicDir = strapi.dirs.public;
25
21
 
26
22
  return {
27
23
  upload(file) {
@@ -30,7 +26,7 @@ module.exports = {
30
26
  return new Promise((resolve, reject) => {
31
27
  // write file in public/assets folder
32
28
  fs.writeFile(
33
- path.join(uploadDir, `/uploads/${file.hash}${file.ext}`),
29
+ path.join(publicDir, `/uploads/${file.hash}${file.ext}`),
34
30
  file.buffer,
35
31
  err => {
36
32
  if (err) {
@@ -46,7 +42,7 @@ module.exports = {
46
42
  },
47
43
  delete(file) {
48
44
  return new Promise((resolve, reject) => {
49
- const filePath = path.join(uploadDir, `/uploads/${file.hash}${file.ext}`);
45
+ const filePath = path.join(publicDir, `/uploads/${file.hash}${file.ext}`);
50
46
 
51
47
  if (!fs.existsSync(filePath)) {
52
48
  return resolve("File doesn't exist");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/provider-upload-local",
3
- "version": "4.0.0-beta.2",
3
+ "version": "4.0.0-beta.6",
4
4
  "description": "Local provider for strapi upload",
5
5
  "homepage": "https://strapi.io",
6
6
  "keywords": [
@@ -44,5 +44,5 @@
44
44
  "scripts": {
45
45
  "test": "echo \"no tests yet\""
46
46
  },
47
- "gitHead": "020680cbb38b6281b3e16df264b9388a087b2b49"
47
+ "gitHead": "74919aafee3d4e275440f12fa3cb077897b576c8"
48
48
  }