Remove changes to upload.ts

This commit is contained in:
Jackson Harper 2022-05-31 15:26:33 -07:00
parent 6faa831e15
commit 11f1b78c45

View file

@ -20,16 +20,9 @@ export const generateUploadSignedUrl = async (
contentType: string,
selectedBucket?: string
): Promise<string> => {
// 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<string> => {
// 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<void> => {
// if (env.dev.isLocal) {
// return
// }
if (env.dev.isLocal) {
return
}
await axios.put(uploadUrl, data, {
headers: {