Only use signed URLs for PDF attachments
This commit is contained in:
@ -98,10 +98,7 @@ import {
|
||||
parsePreparedContent,
|
||||
} from '../../utils/parser'
|
||||
import { parseSearchQuery, sortParamsToSort } from '../../utils/search'
|
||||
import {
|
||||
getStorageFileDetails,
|
||||
makeStorageFilePublic,
|
||||
} from '../../utils/uploads'
|
||||
import { getStorageFileDetails } from '../../utils/uploads'
|
||||
import { itemTypeForContentType } from '../upload_files'
|
||||
|
||||
export enum ArticleFormat {
|
||||
@ -310,7 +307,6 @@ export const createArticleResolver = authorized<
|
||||
pubsub
|
||||
)
|
||||
}
|
||||
await makeStorageFilePublic(uploadFileData.id, uploadFileData.fileName)
|
||||
}
|
||||
|
||||
let libraryItemToReturn: LibraryItem
|
||||
|
||||
@ -143,11 +143,7 @@ export function emailAttachmentRouter() {
|
||||
return res.status(400).send('BAD REQUEST')
|
||||
}
|
||||
|
||||
const uploadFileUrlOverride = await makeStorageFilePublic(
|
||||
uploadFileData.id,
|
||||
uploadFileData.fileName
|
||||
)
|
||||
|
||||
const uploadFileUrlOverride = `https://omnivore.app/attachments/${uploadFileId}/${uploadFile.fileName}`
|
||||
const uploadFileHash = uploadFileDetails.md5Hash
|
||||
const itemType =
|
||||
uploadFile.contentType === 'application/pdf'
|
||||
|
||||
@ -81,22 +81,6 @@ export const generateDownloadSignedUrl = async (
|
||||
return url
|
||||
}
|
||||
|
||||
export const makeStorageFilePublic = async (
|
||||
id: string,
|
||||
fileName: string
|
||||
): Promise<string> => {
|
||||
// if (env.dev.isLocal) {
|
||||
// return 'http://localhost:3000/public/' + id + '/' + fileName
|
||||
// }
|
||||
|
||||
// Makes the file public
|
||||
const filePathName = generateUploadFilePathName(id, fileName)
|
||||
await storage.bucket(bucketName).file(filePathName).makePublic()
|
||||
|
||||
const fileObj = storage.bucket(bucketName).file(filePathName)
|
||||
return fileObj.publicUrl()
|
||||
}
|
||||
|
||||
export const getStorageFileDetails = async (
|
||||
id: string,
|
||||
fileName: string
|
||||
|
||||
Reference in New Issue
Block a user