From 11f1b78c45f8080410302084e7e29983fb4d5f45 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Tue, 31 May 2022 15:26:33 -0700 Subject: [PATCH] Remove changes to upload.ts --- packages/api/src/utils/uploads.ts | 37 +++++++++++++------------------ 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/packages/api/src/utils/uploads.ts b/packages/api/src/utils/uploads.ts index f69189f56..76422657e 100644 --- a/packages/api/src/utils/uploads.ts +++ b/packages/api/src/utils/uploads.ts @@ -20,16 +20,9 @@ export const generateUploadSignedUrl = async ( contentType: string, selectedBucket?: string ): Promise => { - // if (env.dev.isLocal) { - // return 'http://localhost:3000/uploads/' + filePathName - // } - - console.log( - 'signed URL', - filePathName, - contentType, - selectedBucket || bucketName - ) + if (env.dev.isLocal) { + return 'http://localhost:3000/uploads/' + filePathName + } // These options will allow temporary uploading of file with requested content type const options: GetSignedUrlConfig = { @@ -66,9 +59,9 @@ export const makeStorageFilePublic = async ( id: string, fileName: string ): Promise => { - // if (env.dev.isLocal) { - // return 'http://localhost:3000/public/' + id + '/' + fileName - // } + if (env.dev.isLocal) { + return 'http://localhost:3000/public/' + id + '/' + fileName + } // Makes the file public const filePathName = generateUploadFilePathName(id, fileName) @@ -82,12 +75,12 @@ export const getStorageFileDetails = async ( id: string, fileName: string ): Promise<{ md5Hash: string; fileUrl: string }> => { - // if (env.dev.isLocal) { - // return { - // md5Hash: 'some_md5_hash', - // fileUrl: 'http://localhost:3000/public/' + id + '/' + fileName, - // } - // } + if (env.dev.isLocal) { + return { + md5Hash: 'some_md5_hash', + fileUrl: 'http://localhost:3000/public/' + id + '/' + fileName, + } + } const filePathName = generateUploadFilePathName(id, fileName) const file = storage.bucket(bucketName).file(filePathName) @@ -110,9 +103,9 @@ export const uploadToSignedUrl = async ( data: Buffer, contentType: string ): Promise => { - // if (env.dev.isLocal) { - // return - // } + if (env.dev.isLocal) { + return + } await axios.put(uploadUrl, data, { headers: {