From 2182953be5ba86ef46a512c189cf7d5f4dc2eada Mon Sep 17 00:00:00 2001
From: JoramWilander <jwawilander@gmail.com>
Date: Wed, 22 Jul 2015 08:01:10 -0400
Subject: fix the ability to remove file previews once uploaded

---
 web/react/components/file_preview.jsx | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'web/react/components/file_preview.jsx')

diff --git a/web/react/components/file_preview.jsx b/web/react/components/file_preview.jsx
index e69607206..fdd12feec 100644
--- a/web/react/components/file_preview.jsx
+++ b/web/react/components/file_preview.jsx
@@ -16,6 +16,7 @@ module.exports = React.createClass({
         var previews = [];
         this.props.files.forEach(function(filename) {
 
+            var originalFilename = filename;
             var filenameSplit = filename.split('.');
             var ext = filenameSplit[filenameSplit.length-1];
             var type = utils.getFileType(ext);
@@ -27,14 +28,14 @@ module.exports = React.createClass({
 
             if (type === "image") {
                 previews.push(
-                    <div key={filename} className="preview-div" data-filename={filename}>
+                    <div key={filename} className="preview-div" data-filename={originalFilename}>
                         <img className="preview-img" src={filename}/>
                         <a className="remove-preview" onClick={this.handleRemove}><i className="glyphicon glyphicon-remove"/></a>
                     </div>
                 );
             } else {
                 previews.push(
-                    <div key={filename} className="preview-div custom-file" data-filename={filename}>
+                    <div key={filename} className="preview-div custom-file" data-filename={originalFilename}>
                         <div className={"file-icon "+utils.getIconClassName(type)}/>
                         <a className="remove-preview" onClick={this.handleRemove}><i className="glyphicon glyphicon-remove"/></a>
                     </div>
-- 
cgit v1.2.3-1-g7c22

