diff --git a/.changeset/rich-pumpkins-lie.md b/.changeset/rich-pumpkins-lie.md new file mode 100644 index 0000000000000..49ae17a49a420 --- /dev/null +++ b/.changeset/rich-pumpkins-lie.md @@ -0,0 +1,5 @@ +--- +"@medusajs/file-local": patch +--- + +Throw error from local file provider diff --git a/packages/modules/providers/file-local/src/services/local-file.ts b/packages/modules/providers/file-local/src/services/local-file.ts index b5001a6256155..b03fe5d7c5006 100644 --- a/packages/modules/providers/file-local/src/services/local-file.ts +++ b/packages/modules/providers/file-local/src/services/local-file.ts @@ -71,10 +71,13 @@ export class LocalFileService extends AbstractFileProviderService { const filePath = this.getUploadFilePath(baseDir, file.fileKey) try { - await fs.access(filePath, fs.constants.F_OK) + await fs.access(filePath, fs.constants.W_OK) await fs.unlink(filePath) } catch (e) { - // The file does not exist, so it's a noop. + // The file does not exist, we don't do anything + if (e.code !== "ENOENT") { + throw e + } } return