mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-21 15:56:10 +08:00
fix(drag): Drag and drop files with illegial path characters
This commit is contained in:
parent
8f45633fea
commit
5a12dde49c
|
@ -65,9 +65,11 @@ class AttachmentComponent extends React.Component
|
|||
<RetinaImg name="icon-attachment-download.png" mode={RetinaImg.Mode.ContentPreserve} />
|
||||
|
||||
_onDragStart: (event) =>
|
||||
path = FileDownloadStore.pathForFile(@props.file)
|
||||
if fs.existsSync(path)
|
||||
DownloadURL = "#{@props.file.contentType}:#{@props.file.displayName()}:file://#{path}"
|
||||
filePath = FileDownloadStore.pathForFile(@props.file)
|
||||
if fs.existsSync(filePath)
|
||||
# Note: From trial and error, it appears that the second param /MUST/ be the
|
||||
# same as the last component of the filePath URL, or the download fails.
|
||||
DownloadURL = "#{@props.file.contentType}:#{path.basename(filePath)}:file://#{filePath}"
|
||||
event.dataTransfer.setData("DownloadURL", DownloadURL)
|
||||
event.dataTransfer.setData("text/nylas-file-url", DownloadURL)
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue