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:
@ -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
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user