diff --git a/packages/api/src/resolvers/upload_files/index.ts b/packages/api/src/resolvers/upload_files/index.ts index 58eca5370..93e622ea0 100644 --- a/packages/api/src/resolvers/upload_files/index.ts +++ b/packages/api/src/resolvers/upload_files/index.ts @@ -109,9 +109,12 @@ export const uploadFileRequestResolver = authorized< input.contentType ) + // If this is a file URL, we swap in a special URL + const attachmentUrl = `https://omnivore.app/attachments/${uploadFilePathName}` if (isFileUrl(input.url)) { await authTrx(async (tx) => { await tx.getRepository(UploadFile).update(uploadFileId, { + url: attachmentUrl, status: UploadFileStatus.Initialized, }) }) diff --git a/packages/api/src/routers/svc/email_attachment.ts b/packages/api/src/routers/svc/email_attachment.ts index 096359673..6c127135b 100644 --- a/packages/api/src/routers/svc/email_attachment.ts +++ b/packages/api/src/routers/svc/email_attachment.ts @@ -142,7 +142,12 @@ export function emailAttachmentRouter() { return res.status(400).send('BAD REQUEST') } - const uploadFileUrlOverride = `https://omnivore.app/attachments/${uploadFileId}/${uploadFile.fileName}` + const uploadFilePathName = generateUploadFilePathName( + uploadFileId, + uploadFile.fileName + ) + + const uploadFileUrlOverride = `https://omnivore.app/attachments/${uploadFilePathName}` const uploadFileHash = uploadFileDetails.md5Hash const itemType = uploadFile.contentType === 'application/pdf'