Use public API content URLs in viewer component

- Required a more sophisticated way to detect PDF content
This commit is contained in:
Will Abson
2016-06-07 14:44:17 +01:00
parent e39439b68c
commit 294cca91de
4 changed files with 19 additions and 27 deletions

View File

@@ -34,6 +34,9 @@ export class ViewerComponent {
@Input()
urlFile: string;
@Input()
mimeType: string = null;
@Input()
overlayMode: boolean = false;
@@ -63,8 +66,6 @@ export class ViewerComponent {
if (this.urlFile) {
this.nameFile = this.getFilenameFromUrl(this.urlFile);
this.extension = this.getFileExtension(this.nameFile);
this.urlFile = this.addAlfrescoTicket(this.urlFile);
}
resolve();
});
@@ -116,7 +117,7 @@ export class ViewerComponent {
* check if the current file is a suppoerted pdf extension
*/
private isPdf() {
return this.extension === 'pdf';
return this.extension === 'pdf' || this.mimeType == 'application/pdf';
}
/**
@@ -142,22 +143,6 @@ export class ViewerComponent {
}
}
/**
* Add Ticket to the file request
* @returns {string}
*/
private addAlfrescoTicket(url: string) {
return url + '?alf_ticket=' + this.getAlfrescoTicket();
}
/**
* Get the token from the local storage
* @returns {string}
*/
private getAlfrescoTicket() {
return localStorage.getItem('token');
}
/**
* Hide the othe possible menu in th eapplication
*/