Merge pull request #3000 from omnivore-app/fix/pdf-url

fix: showing original url instead of signed url for pdf files in search api response
This commit is contained in:
Hongbo Wu
2023-10-24 13:20:51 +08:00
committed by GitHub
4 changed files with 6 additions and 3 deletions

View File

@ -129,6 +129,10 @@ export class LibraryItem {
@JoinColumn({ name: 'upload_file_id' })
uploadFile?: UploadFile
// get upload_file_id without joining relations
@Column('text', { nullable: true })
uploadFileId?: string
@Column('enum', { enum: ContentReaderType, default: ContentReaderType.WEB })
contentReader!: ContentReaderType

View File

@ -465,7 +465,7 @@ export const functionResolvers = {
async url(item: SearchItem, _: unknown, ctx: WithDataSourcesContext) {
if (
(item.pageType == PageType.File || item.pageType == PageType.Book) &&
ctx.uid &&
ctx.claims &&
item.uploadFileId
) {
const upload = await findUploadFileById(item.uploadFileId)

View File

@ -242,7 +242,7 @@ export const parsedContentToLibraryItem = ({
publishedAt: validatedDate(
publishedAt || parsedContent?.publishedDate || undefined
),
uploadFile: { id: uploadFileId ?? undefined },
uploadFileId: uploadFileId || undefined,
readingProgressTopPercent: 0,
readingProgressHighestReadAnchor: 0,
state: state

View File

@ -268,7 +268,6 @@ export const libraryItemToSearchItem = (item: LibraryItem): SearchItem => ({
),
image: item.thumbnail,
highlights: item.highlights?.map(highlightDataToHighlight),
uploadFileId: item.uploadFile?.id,
wordsCount: item.wordCount,
})