diff options
author | hmhealey <harrisonmhealey@gmail.com> | 2016-01-25 09:49:25 -0500 |
---|---|---|
committer | hmhealey <harrisonmhealey@gmail.com> | 2016-01-25 10:17:04 -0500 |
commit | 68285cf1a9d5b37e857298a84e863cad6ffcdc7a (patch) | |
tree | 5a93ab7a3b70f084577ac646922cb9c346be5c21 | |
parent | 1cd25cf3806f6ceb2e47a3bc791569cedd0acf1d (diff) | |
download | chat-68285cf1a9d5b37e857298a84e863cad6ffcdc7a.tar.gz chat-68285cf1a9d5b37e857298a84e863cad6ffcdc7a.tar.bz2 chat-68285cf1a9d5b37e857298a84e863cad6ffcdc7a.zip |
Fixed info displayed for files with 0 size or with no extension
-rw-r--r-- | web/react/components/file_info_preview.jsx | 11 |
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 ( |