diff --git a/src/i18n/en-US.properties b/src/i18n/en-US.properties index dc123301c..43c7a421d 100644 --- a/src/i18n/en-US.properties +++ b/src/i18n/en-US.properties @@ -39,7 +39,7 @@ text_truncated=This file has been truncated due to size limits. Please download # Default preview error message error_generic=We're sorry, the preview didn't load. # Default preview error message -error_unsupported=We're sorry, the preview didn't load. {1} files are not currently supported. +error_unsupported=We're sorry, this file type is not currently supported. # Account doesn't have a sufficient tariff to preview the requested file type error_account=We're sorry, your account is unable to preview this file type. # No permissions preview error message diff --git a/src/lib/Preview.js b/src/lib/Preview.js index 7f27403f2..6cf8bcceb 100644 --- a/src/lib/Preview.js +++ b/src/lib/Preview.js @@ -22,7 +22,6 @@ import { getHeaders, findScriptLocation, appendQueryParams, - replacePlaceholders, stripAuthFromString, isValidFileId, isBoxWebApp, @@ -1116,10 +1115,16 @@ class Preview extends EventEmitter { return viewer.EXT.indexOf(this.file.extension) > -1; }); - const code = isFileTypeSupported ? ERROR_CODE.ACCOUNT : ERROR_CODE.UNSUPPORTED_FILE_TYPE; - const message = isFileTypeSupported - ? __('error_account') - : replacePlaceholders(__('error_unsupported'), [(this.file.extension || '').toUpperCase()]); + let code; + let message; + // If the file type is supported, then the default error is account related + if (isFileTypeSupported) { + code = ERROR_CODE.ACCOUNT; + message = __('error_account'); + } else { + code = ERROR_CODE.UNSUPPORTED_FILE_TYPE; + message = __('error_unsupported'); + } throw new PreviewError(code, message); } diff --git a/src/lib/__tests__/Preview-test.js b/src/lib/__tests__/Preview-test.js index 0bf55433c..995d603b8 100644 --- a/src/lib/__tests__/Preview-test.js +++ b/src/lib/__tests__/Preview-test.js @@ -1617,13 +1617,12 @@ describe('lib/Preview', () => { }); it('should throw an unsupported error if there is no loader for general file types', () => { - preview.file.extension = 'zip'; stubs.getLoader.returns(undefined); try { preview.loadViewer(); } catch (e) { - expect(e.message).to.equal(util.replacePlaceholders(__('error_unsupported'), ['ZIP'])); + expect(e.message).to.equal(__('error_unsupported')); } });