[ACA-4202] - forcing firefox to ignore cache when document version ha… (#6807)

* [ACA-4202] - forcing firefox to ignore cache when document version has changed

* fxed lint
This commit is contained in:
Vito 2021-04-09 11:44:14 +01:00 committed by GitHub
parent 318ce0e346
commit f9a7836a5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 0 deletions

View File

@ -68,6 +68,9 @@ export class PdfViewerComponent implements OnChanges, OnDestroy {
@Input()
thumbnailsTemplate: TemplateRef<any> = null;
@Input()
cacheType: string = '';
@Output()
rendered = new EventEmitter<any>();
@ -161,6 +164,11 @@ export class PdfViewerComponent implements OnChanges, OnDestroy {
url: urlFile.currentValue,
withCredentials: this.appConfigService.get<boolean>('auth.withCredentials', undefined)
};
if (this.cacheType) {
pdfSource.httpHeaders = {
'Cache-Control': this.cacheType
};
}
this.executePdf(pdfSource);
}

View File

@ -212,6 +212,7 @@
[blobFile]="blobFile"
[urlFile]="urlFileContent"
[nameFile]="displayName"
[cacheType]="cacheTypeForContent"
(error)="onUnsupportedFile()"></adf-pdf-viewer>
</ng-container>

View File

@ -224,6 +224,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
viewerExtensions: Array<ViewerExtensionRef> = [];
private cacheBusterNumber;
cacheTypeForContent = '';
// Extensions that are supported by the Viewer without conversion
private extensions = {
@ -278,6 +279,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
this.closeOverlayManager();
this.loadExtensions();
this.cacheTypeForContent = '';
}
private loadExtensions() {
@ -299,6 +301,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
private onNodeUpdated(node: Node) {
if (node && node.id === this.nodeId) {
this.cacheTypeForContent = 'no-cache';
this.generateCacheBusterNumber();
this.isLoading = true;
this.setUpNodeFile(node).then(() => {