@medusajs/file-local-next 0.0.3-snapshot-20240531094527 → 0.0.3-snapshot-20240607093839

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,7 +16,7 @@ class LocalFileService extends utils_1.AbstractFileProviderService {
16
16
  this.getUploadFileUrl = (fileKey) => {
17
17
  return path_1.default.join(this.backendUrl_, this.getUploadFilePath(fileKey));
18
18
  };
19
- this.uploadDir_ = options?.upload_dir || "uploads";
19
+ this.uploadDir_ = options?.upload_dir || path_1.default.join(__dirname, "uploads");
20
20
  this.backendUrl_ = options?.backend_url || "http://localhost:9000";
21
21
  }
22
22
  async upload(file) {
@@ -27,9 +27,7 @@ class LocalFileService extends utils_1.AbstractFileProviderService {
27
27
  throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `No filename provided`);
28
28
  }
29
29
  const parsedFilename = path_1.default.parse(file.filename);
30
- if (parsedFilename.dir) {
31
- this.ensureDirExists(parsedFilename.dir);
32
- }
30
+ await this.ensureDirExists(parsedFilename.dir);
33
31
  const fileKey = path_1.default.join(parsedFilename.dir, `${Date.now()}-${parsedFilename.base}`);
34
32
  const filePath = this.getUploadFilePath(fileKey);
35
33
  const fileUrl = this.getUploadFileUrl(fileKey);
@@ -72,4 +70,4 @@ class LocalFileService extends utils_1.AbstractFileProviderService {
72
70
  }
73
71
  exports.LocalFileService = LocalFileService;
74
72
  LocalFileService.identifier = "localfs";
75
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYWwtZmlsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zZXJ2aWNlcy9sb2NhbC1maWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7OztBQUNBLDJDQUEwRTtBQUMxRSwyREFBNEI7QUFDNUIsZ0RBQXVCO0FBRXZCLE1BQWEsZ0JBQWlCLFNBQVEsbUNBQTJCO0lBSy9ELFlBQVksQ0FBQyxFQUFFLE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QUUsRUFBRSxTQUFTLEVBQUUsSUFBSSxFQUFFLENBQUMsQ0FBQTtTQUNsRDtJQUNILENBQUM7O0FBMUZILDRDQTJGQztBQTFGUSwyQkFBVSxHQUFHLFNBQVMsQ0FBQSJ9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/file-local-next",
3
- "version": "0.0.3-snapshot-20240531094527",
3
+ "version": "0.0.3-snapshot-20240607093839",
4
4
  "description": "Local filesystem file storage for Medusa",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -29,7 +29,7 @@
29
29
  "typescript": "^4.9.5"
30
30
  },
31
31
  "dependencies": {
32
- "@medusajs/utils": "1.12.0-snapshot-20240531094527"
32
+ "@medusajs/utils": "1.12.0-snapshot-20240607093839"
33
33
  },
34
34
  "keywords": [
35
35
  "medusa-plugin",