mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Unify 404 logic
This commit is contained in:
		| @@ -21,8 +21,9 @@ import { dirtyCheck, DirtyComponent } from '@ngneat/dirty-check-forms' | |||||||
| import { PDFDocumentProxy, PdfViewerModule } from 'ng2-pdf-viewer' | import { PDFDocumentProxy, PdfViewerModule } from 'ng2-pdf-viewer' | ||||||
| import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons' | import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons' | ||||||
| import { DeviceDetectorService } from 'ngx-device-detector' | import { DeviceDetectorService } from 'ngx-device-detector' | ||||||
| import { BehaviorSubject, Observable, Subject } from 'rxjs' | import { BehaviorSubject, Observable, of, Subject } from 'rxjs' | ||||||
| import { | import { | ||||||
|  |   catchError, | ||||||
|   debounceTime, |   debounceTime, | ||||||
|   distinctUntilChanged, |   distinctUntilChanged, | ||||||
|   filter, |   filter, | ||||||
| @@ -406,7 +407,13 @@ export class DocumentDetailComponent | |||||||
|     this.thumbUrl = this.documentsService.getThumbUrl(documentId) |     this.thumbUrl = this.documentsService.getThumbUrl(documentId) | ||||||
|     this.documentsService |     this.documentsService | ||||||
|       .get(documentId) |       .get(documentId) | ||||||
|       .pipe(first()) |       .pipe( | ||||||
|  |         catchError(() => { | ||||||
|  |           // 404 is handled in the subscribe below | ||||||
|  |           return of(null) | ||||||
|  |         }), | ||||||
|  |         first() | ||||||
|  |       ) | ||||||
|       .subscribe({ |       .subscribe({ | ||||||
|         next: (doc) => { |         next: (doc) => { | ||||||
|           if (!doc) { |           if (!doc) { | ||||||
| @@ -452,10 +459,6 @@ export class DocumentDetailComponent | |||||||
|             }) |             }) | ||||||
|           this.setupDirtyTracking(useDoc, doc) |           this.setupDirtyTracking(useDoc, doc) | ||||||
|         }, |         }, | ||||||
|         error: () => |  | ||||||
|           this.router.navigate(['404'], { |  | ||||||
|             replaceUrl: true, |  | ||||||
|           }), |  | ||||||
|       }) |       }) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 shamoon
					shamoon