Skip to content

Commit

Permalink
changes:using signedUrl for download in both private and public bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenKDass committed Jul 19, 2024
1 parent 86cf8ee commit ba9aa51
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions module/files/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,22 +159,14 @@ module.exports = class FilesHelper {
file: file,
payload: { sourcePath: file },
cloudStorage: cloudStorage.toUpperCase(),
};
if (process.env.CLOUD_STORAGE_PROVIDER !== constants.common.G_CLOUD) {
response.downloadableUrl = await cloudClient.getDownloadableUrl(
bucket,
file,
linkExpireTime // Link ExpireIn
);
}else{
// Generate a read-only pre-signed URL for downloading a file from the GCloud bucket
};
// Generate a read-only pre-signed URL for downloading a file from the Cloud bucket
response.getDownloadableUrl = await cloudClient.getSignedUrl(
bucket, // bucket name
file, // file path
linkExpireTime, // expire
constants.common.READ_PERMISSION // read/write
);
}
if (!serviceUpload) {
response.url = await cloudClient.getSignedUrl(
bucket, // bucket name
Expand Down

0 comments on commit ba9aa51

Please sign in to comment.