A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Render frontend html as plain text
shamoon49754d33fa66
diff --git a/src-ui/src/app/components/document-detail/document-detail.component.html b/src-ui/src/app/components/document-detail/document-detail.component.htmlindex 7b21d4b50..0eff363f4 100644--- a/src-ui/src/app/components/document-detail/document-detail.component.html+++ b/src-ui/src/app/components/document-detail/document-detail.component.html@@ -207,8 +207,8 @@<object [data]="previewUrl | safeUrl" class="preview-sticky" width="100%"></object></ng-template></ng-container>- <ng-container *ngIf="getContentType() === 'text/plain'">- <div [innerHTML]="previewHtml | safeHtml" class="preview-sticky bg-light p-3" width="100%"></div>+ <ng-container *ngIf="renderAsPlainText">+ <div [innerText]="previewText" class="preview-sticky bg-light p-3" width="100%"></div></ng-container><div *ngIf="requiresPassword" class="password-prompt"><form>diff --git a/src-ui/src/app/components/document-detail/document-detail.component.ts b/src-ui/src/app/components/document-detail/document-detail.component.tsindex 599ae8523..c9e98f030 100644--- a/src-ui/src/app/components/document-detail/document-detail.component.ts+++ b/src-ui/src/app/components/document-detail/document-detail.component.ts@@ -81,7 +81,7 @@ export class DocumentDetailComponenttitle: stringtitleSubject: Subject<string> = new Subject()previewUrl: string- _previewHtml: string+ previewText: stringdownloadUrl: stringdownloadOriginalUrl: string@@ -164,6 +164,12 @@ export class DocumentDetailComponent: this.metadata?.original_mime_type}+ get renderAsPlainText(): boolean {+ return ['text/plain', 'application/csv', 'text/csv'].includes(+ this.getContentType()+ )+ }+get isRTL() {if (!this.metadata || !this.metadata.lang) return falseelse {@@ -220,10 +226,10 @@ export class DocumentDetailComponentthis.previewUrl = this.documentsService.getPreviewUrl(this.documentId)this.http.get(this.previewUrl, { responseType: 'text' }).subscribe({next: (res) => {- this._previewHtml = res.toString()+ this.previewText = res.toString()},error: (err) => {- this._previewHtml = $localize`An error occurred loading content: ${+ this.previewText = $localize`An error occurred loading content: ${err.message ?? err.toString()}`},@@ -752,8 +758,4 @@ export class DocumentDetailComponent))}-- get previewHtml(): string {- return this._previewHtml- }}