From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sat, 23 Aug 2025 02:42:33 +0000 (-0700) Subject: Unify 404 logic X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F10662%2Fhead;p=thirdparty%2Fpaperless-ngx.git Unify 404 logic --- 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.ts index 06775ed30..a7cda447d 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 @@ -21,8 +21,9 @@ import { dirtyCheck, DirtyComponent } from '@ngneat/dirty-check-forms' import { PDFDocumentProxy, PdfViewerModule } from 'ng2-pdf-viewer' import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons' import { DeviceDetectorService } from 'ngx-device-detector' -import { BehaviorSubject, Observable, Subject } from 'rxjs' +import { BehaviorSubject, Observable, of, Subject } from 'rxjs' import { + catchError, debounceTime, distinctUntilChanged, filter, @@ -406,7 +407,13 @@ export class DocumentDetailComponent this.thumbUrl = this.documentsService.getThumbUrl(documentId) this.documentsService .get(documentId) - .pipe(first()) + .pipe( + catchError(() => { + // 404 is handled in the subscribe below + return of(null) + }), + first() + ) .subscribe({ next: (doc) => { if (!doc) { @@ -452,10 +459,6 @@ export class DocumentDetailComponent }) this.setupDirtyTracking(useDoc, doc) }, - error: () => - this.router.navigate(['404'], { - replaceUrl: true, - }), }) }