mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-13 13:19:34 +08:00
fix(downloads): Cannot download unnamed attachments (resolves Sentry #598)
This commit is contained in:
parent
4fc16b2d6e
commit
c3a90e4f5d
1 changed files with 11 additions and 3 deletions
|
@ -119,14 +119,22 @@ FileDownloadStore = Reflux.createStore
|
||||||
|
|
||||||
######### PUBLIC #######################################################
|
######### PUBLIC #######################################################
|
||||||
|
|
||||||
# Returns a hash of download objects keyed by fileId
|
# Returns a path on disk for saving the file. Note that we must account
|
||||||
|
# for files that don't have a name and avoid returning <downloads/dir/"">
|
||||||
|
# which causes operations to happen on the directory (badness!)
|
||||||
|
#
|
||||||
pathForFile: (file) ->
|
pathForFile: (file) ->
|
||||||
return undefined unless file
|
return undefined unless file
|
||||||
path.join(@_downloadDirectory, file.id, "#{file.filename}")
|
if file.filename and file.filename.length > 0
|
||||||
|
downloadFilename = file.filename
|
||||||
|
else
|
||||||
|
downloadFilename = file.id
|
||||||
|
path.join(@_downloadDirectory, file.id, downloadFilename)
|
||||||
|
|
||||||
downloadDataForFile: (fileId) -> @_downloads[fileId]?.data()
|
downloadDataForFile: (fileId) -> @_downloads[fileId]?.data()
|
||||||
|
|
||||||
|
# Returns a hash of download objects keyed by fileId
|
||||||
|
#
|
||||||
downloadDataForFiles: (fileIds=[]) ->
|
downloadDataForFiles: (fileIds=[]) ->
|
||||||
downloadData = {}
|
downloadData = {}
|
||||||
fileIds.forEach (fileId) =>
|
fileIds.forEach (fileId) =>
|
||||||
|
|
Loading…
Reference in a new issue