summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2016-01-25 10:40:39 -0500
committerCorey Hulen <corey@hulen.com>2016-01-25 10:40:39 -0500
commit5478ea34e436109ece417c3704a1fa36d3aba4a5 (patch)
tree5485132ef310c9e4204b917a36598ee78571d428 /web
parentd20f9f6ae1431cc3cac0b89bbda1f8d85e1f3c45 (diff)
parent68285cf1a9d5b37e857298a84e863cad6ffcdc7a (diff)
downloadchat-5478ea34e436109ece417c3704a1fa36d3aba4a5.tar.gz
chat-5478ea34e436109ece417c3704a1fa36d3aba4a5.tar.bz2
chat-5478ea34e436109ece417c3704a1fa36d3aba4a5.zip
Merge pull request #1977 from hmhealey/plt1685
PLT-1685 Fixed handling of files with no extension
Diffstat (limited to 'web')
-rw-r--r--web/react/components/file_info_preview.jsx11
1 files changed, 8 insertions, 3 deletions
diff --git a/web/react/components/file_info_preview.jsx b/web/react/components/file_info_preview.jsx
index 4b76cd162..45d89007f 100644
--- a/web/react/components/file_info_preview.jsx
+++ b/web/react/components/file_info_preview.jsx
@@ -5,11 +5,16 @@ import * as Utils from '../utils/utils.jsx';
export default function FileInfoPreview({filename, fileUrl, fileInfo}) {
// non-image files include a section providing details about the file
- let infoString = 'File type ' + fileInfo.extension.toUpperCase();
- if (fileInfo.size > 0) {
- infoString += ', Size ' + Utils.fileSizeToString(fileInfo.size);
+ const infoParts = [];
+
+ if (fileInfo.extension !== '') {
+ infoParts.push('File type ' + fileInfo.extension.toUpperCase());
}
+ infoParts.push('Size ' + Utils.fileSizeToString(fileInfo.size));
+
+ const infoString = infoParts.join(', ');
+
const name = decodeURIComponent(Utils.getFileName(filename));
return (