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