refactor: rename getSignedUrl to getPublicUrl for clarity in storage functions
This commit is contained in:
@@ -74,7 +74,6 @@ export class S3StorageAdapter implements StorageProvider {
|
||||
Bucket: this.bucketName,
|
||||
Key: key,
|
||||
ContentType: contentType,
|
||||
ACL: ObjectCannedACL.public_read,
|
||||
});
|
||||
|
||||
return await getSignedUrl(this.s3Client, command, { expiresIn: 3600 });
|
||||
|
||||
@@ -7,7 +7,7 @@ import { TypedResult } from '@/utils/types/results';
|
||||
|
||||
const storage: StorageProvider = createStorageProvider();
|
||||
|
||||
export const getSignedUrl = async (
|
||||
export const getPublicUrl = async (
|
||||
key: string,
|
||||
storageProvider?: StorageProvider
|
||||
): Promise<TypedResult<string>> => {
|
||||
|
||||
@@ -26,7 +26,7 @@ export const uploadFile = wrap(async (file: File) => {
|
||||
|
||||
const existsResult = await storage.checkExists(fileKey);
|
||||
if (existsResult) {
|
||||
const presignedUrl = await storage.getSignedUrl(fileKey);
|
||||
const presignedUrl = await storage.getPublicUrl(fileKey);
|
||||
if (!presignedUrl.ok) {
|
||||
throw new Error('Failed to retrieve file URL');
|
||||
}
|
||||
@@ -48,7 +48,7 @@ export const uploadFile = wrap(async (file: File) => {
|
||||
throw new Error('Failed to upload file');
|
||||
}
|
||||
|
||||
const presignedUrl = await storage.getSignedUrl(fileKey);
|
||||
const presignedUrl = await storage.getPublicUrl(fileKey);
|
||||
if (!presignedUrl.ok) {
|
||||
throw new Error('Failed to retrieve file URL');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user