Skip to content

Commit 9b833b2

Browse files
committed
fix:Return the backend URL for private files of local file provider
1 parent ba3b1da commit 9b833b2

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

integration-tests/http/__tests__/product/admin/product-export.spec.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { ModuleRegistrationName } from "@medusajs/utils"
1212
jest.setTimeout(50000)
1313

1414
const compareCSVs = async (filePath, expectedFilePath) => {
15-
let fileContent = await fs.readFile(filePath, { encoding: "utf-8" })
15+
const asLocalPath = filePath.replace("http://localhost:9000", process.cwd())
16+
let fileContent = await fs.readFile(asLocalPath, { encoding: "utf-8" })
1617
let fixturesContent = await fs.readFile(expectedFilePath, {
1718
encoding: "utf-8",
1819
})

packages/modules/providers/file-local/src/services/local-file.ts

-5
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ export class LocalFileService extends AbstractFileProviderService {
7777
return
7878
}
7979

80-
// For private files, we simply return the file path, which can then be loaded manually by the backend.
8180
// The local file provider doesn't support presigned URLs for private files (i.e files not placed in /static).
8281
async getPresignedDownloadUrl(
8382
file: FileTypes.ProviderGetFileDTO
@@ -96,10 +95,6 @@ export class LocalFileService extends AbstractFileProviderService {
9695
)
9796
}
9897

99-
if (isPrivate) {
100-
return filePath
101-
}
102-
10398
return this.getUploadFileUrl(file.fileKey)
10499
}
105100

0 commit comments

Comments
 (0)