Skip to content

Commit

Permalink
Update: Uppercase unsupported file types (#710)
Browse files Browse the repository at this point in the history
Uppercase the extensions for unsupported file types to prevent the dual period `...didn't load. .zip files...` --> `...didn't load. ZIP files...`
  • Loading branch information
tonyjin committed Mar 8, 2018
1 parent cac7279 commit b3ddc6a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/Preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ class Preview extends EventEmitter {
const code = isFileTypeSupported ? ERROR_CODE.ACCOUNT : ERROR_CODE.UNSUPPORTED_FILE_TYPE;
const message = isFileTypeSupported
? __('error_account')
: replacePlaceholders(__('error_unsupported'), [`.${this.file.extension}`]);
: replacePlaceholders(__('error_unsupported'), [(this.file.extension || '').toUpperCase()]);

throw new PreviewError(code, message);
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/__tests__/Preview-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1507,7 +1507,7 @@ describe('lib/Preview', () => {
preview.loadViewer();
} catch (e) {
expect(e.message).to.equal(
util.replacePlaceholders(__('error_unsupported'), [`.${preview.file.extension}`])
util.replacePlaceholders(__('error_unsupported'), ['ZIP'])
);
}
});
Expand Down

0 comments on commit b3ddc6a

Please sign in to comment.