From 0ddafc4bcd83ac5fb2143feaf9b66e2024a5c3ba Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Wed, 20 Aug 2014 16:21:50 -0700 Subject: [PATCH] Remarkup - call pasted files "pasted_file" rather than "undefined" Summary: Fixes T5917. Turns out that pasted files don't get a name - "what is data on a clipboard anyway?" / see https://code.google.com/p/chromium/issues/detail?id=361145 Test Plan: pasted a file and got the slightly better name "pasted_file" Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T5917 Differential Revision: https://secure.phabricator.com/D10310 --- resources/celerity/map.php | 22 +++++++++---------- webroot/rsrc/js/core/DragAndDropFileUpload.js | 8 ++++++- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index c901d49f77..fa0227339e 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -11,7 +11,7 @@ return array( 'core.pkg.js' => 'f67c8265', 'darkconsole.pkg.js' => 'df001cab', 'differential.pkg.css' => '36884139', - 'differential.pkg.js' => 'eb182ccd', + 'differential.pkg.js' => 'fe026527', 'diffusion.pkg.css' => '591664fa', 'diffusion.pkg.js' => 'bfc0737b', 'maniphest.pkg.css' => 'f5d89daf', @@ -437,7 +437,7 @@ return array( 'rsrc/js/application/uiexample/gesture-example.js' => '558829c2', 'rsrc/js/application/uiexample/notification-example.js' => '7a9677fc', 'rsrc/js/core/Busy.js' => '6453c869', - 'rsrc/js/core/DragAndDropFileUpload.js' => 'f61aa8ec', + 'rsrc/js/core/DragAndDropFileUpload.js' => '8c49f386', 'rsrc/js/core/DraggableList.js' => 'bfccc644', 'rsrc/js/core/FileUpload.js' => 'a4ae61bf', 'rsrc/js/core/Hovercard.js' => '7e8468ae', @@ -712,7 +712,7 @@ return array( 'phabricator-countdown-css' => '86b7b0a0', 'phabricator-crumbs-view-css' => '7fbf25b8', 'phabricator-dashboard-css' => 'a2bfdcbf', - 'phabricator-drag-and-drop-file-upload' => 'f61aa8ec', + 'phabricator-drag-and-drop-file-upload' => '8c49f386', 'phabricator-draggable-list' => 'bfccc644', 'phabricator-fatal-config-template-css' => '25d446d6', 'phabricator-feed-css' => '4e544db4', @@ -1385,6 +1385,14 @@ return array( 'javelin-request', 'javelin-typeahead-source', ), + '8c49f386' => array( + 'javelin-install', + 'javelin-util', + 'javelin-request', + 'javelin-dom', + 'javelin-uri', + 'phabricator-file-upload', + ), '8d199d97' => array( 'javelin-behavior', 'javelin-dom', @@ -1867,14 +1875,6 @@ return array( 'multirow-row-manager', 'javelin-json', ), - 'f61aa8ec' => array( - 'javelin-install', - 'javelin-util', - 'javelin-request', - 'javelin-dom', - 'javelin-uri', - 'phabricator-file-upload', - ), 'f6555212' => array( 'javelin-install', 'javelin-reactornode', diff --git a/webroot/rsrc/js/core/DragAndDropFileUpload.js b/webroot/rsrc/js/core/DragAndDropFileUpload.js index 35a8482e00..297b5ef929 100644 --- a/webroot/rsrc/js/core/DragAndDropFileUpload.js +++ b/webroot/rsrc/js/core/DragAndDropFileUpload.js @@ -158,7 +158,13 @@ JX.install('PhabricatorDragAndDropFileUpload', { if (!/^image\//.test(item.type)) { continue; } - this._sendRequest(item.getAsFile()); + var spec = item.getAsFile(); + // pasted files don't have a name; see + // https://code.google.com/p/chromium/issues/detail?id=361145 + if (!spec.name) { + spec.name = 'pasted_file'; + } + this._sendRequest(spec); } })); }