Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contentType mismatch solved by NSS #150

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions src/widgets/dragAndDrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,16 @@ function makeDraggable (tr, obj) {
}, false)
}

/* uploadFiles
/** uploadFiles
**
** Generic uploader of local files to the web
** typically called from dropped file handler
** Params
** fetcher instance of class Fetcher as in kb.fetcher
** files Array of file objects
** fileBase URI of folder in which to put files (except images) (no trailing slash)
** imageBase URI of folder in which to put images
** successHandler(file, uploadedURI) Called after each success upload
**
** @param {Fetcher} fetcher instance of class Fetcher as in kb.fetcher
** @param {Array<File>} files Array of file objects
** @param {String} fileBase URI of folder in which to put files (except images) (no trailing slash)
** @param {String } imageBase URI of folder in which to put images
** @param successHandler function(file, uploadedURI) Called after EACH success upload
** With file object an final URI as params
*/
function uploadFiles (fetcher, files, fileBase, imageBase, successHandler) {
Expand All @@ -165,12 +165,6 @@ function uploadFiles (fetcher, files, fileBase, imageBase, successHandler) {
alert(msg)
throw new Error(msg)
}
} else {
var extension = mime.extension(theFile.type)
if (theFile.type !== mime.lookup(theFile.name)) {
suffix = '_.' + extension
console.log('MIME TYPE MISMATCH -- adding extension: ' + suffix)
}
}
var folderName = theFile.type.startsWith('image/') ? imageBase || fileBase : fileBase
var destURI = folderName + (folderName.endsWith('/') ? '' : '/') + encodeURIComponent(theFile.name) + suffix
Expand Down