diff --git a/apps/papra-client/src/modules/documents/pages/document.page.tsx b/apps/papra-client/src/modules/documents/pages/document.page.tsx index ef5cd81..60edb59 100644 --- a/apps/papra-client/src/modules/documents/pages/document.page.tsx +++ b/apps/papra-client/src/modules/documents/pages/document.page.tsx @@ -6,7 +6,7 @@ import { queryClient } from '@/modules/shared/query/query-client'; import { DocumentTagPicker } from '@/modules/tags/components/tag-picker.component'; import { CreateTagModal } from '@/modules/tags/pages/tags.page'; import { addTagToDocument, removeTagFromDocument } from '@/modules/tags/tags.services'; -import { Alert } from '@/modules/ui/components/alert'; +import { Alert, AlertDescription } from '@/modules/ui/components/alert'; import { Button } from '@/modules/ui/components/button'; import { Separator } from '@/modules/ui/components/separator'; import { createToast } from '@/modules/ui/components/sonner'; @@ -231,7 +231,7 @@ export const DocumentPage: Component = () => { - + Info Content @@ -287,6 +287,13 @@ export const DocumentPage: Component = () => { Edit + + +
+ + The content of the document is automatically extracted from the document on upload. It is only used for search and indexing purposes. + +
)} > diff --git a/apps/papra-server/src/modules/documents/documents.repository.ts b/apps/papra-server/src/modules/documents/documents.repository.ts index b580cd6..805a14b 100644 --- a/apps/papra-server/src/modules/documents/documents.repository.ts +++ b/apps/papra-server/src/modules/documents/documents.repository.ts @@ -6,6 +6,7 @@ import { and, count, desc, eq, getTableColumns, lt, sql, sum } from 'drizzle-orm import { omit } from 'lodash-es'; import { isUniqueConstraintError } from '../shared/db/constraints.models'; import { withPagination } from '../shared/db/pagination'; +import { omitUndefined } from '../shared/utils'; import { documentsTagsTable, tagsTable } from '../tags/tags.table'; import { createDocumentAlreadyExistsError } from './documents.errors'; import { documentsTable } from './documents.table'; @@ -327,19 +328,9 @@ async function getAllOrganizationTrashDocumentIds({ organizationId, db }: { orga } async function updateDocument({ documentId, organizationId, name, content, db }: { documentId: string; organizationId: string; name?: string; content?: string; db: Database }) { - const updateData: Partial<{ name: string; content: string }> = {}; - - if (name !== undefined) { - updateData.name = name; - } - - if (content !== undefined) { - updateData.content = content; - } - const [document] = await db .update(documentsTable) - .set(updateData) + .set(omitUndefined({ name, content })) .where( and( eq(documentsTable.id, documentId),