Skip to content

Commit

Permalink
fix:Return the backend URL for private files of local file provider
Browse files Browse the repository at this point in the history
  • Loading branch information
sradevski committed Jul 29, 2024
1 parent ba3b1da commit 9b833b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import { ModuleRegistrationName } from "@medusajs/utils"
jest.setTimeout(50000)

const compareCSVs = async (filePath, expectedFilePath) => {
let fileContent = await fs.readFile(filePath, { encoding: "utf-8" })
const asLocalPath = filePath.replace("http://localhost:9000", process.cwd())
let fileContent = await fs.readFile(asLocalPath, { encoding: "utf-8" })
let fixturesContent = await fs.readFile(expectedFilePath, {
encoding: "utf-8",
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ export class LocalFileService extends AbstractFileProviderService {
return
}

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

if (isPrivate) {
return filePath
}

return this.getUploadFileUrl(file.fileKey)
}

Expand Down

0 comments on commit 9b833b2

Please sign in to comment.