Skip to content

Commit

Permalink
Merge pull request #53 from BenLubar/paste-to-upload-category
Browse files Browse the repository at this point in the history
Fix paste-to-upload permissions and Edge support
  • Loading branch information
barisusakli committed Jul 12, 2016
2 parents a951c0b + 388dbc6 commit a2dbd83
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions static/lib/composer/uploads.js
Expand Up @@ -180,16 +180,17 @@ define('composer/uploads', [
return false;
}

blob.name = 'upload-' + utils.generateUUID();
var blobName = 'upload-' + utils.generateUUID();

var fd = null;
if (window.FormData) {
fd = new FormData();
fd.append('files[]', blob, blob.name);
fd.append('files[]', blob, blobName);
}

uploadContentFiles({
files: [blob],
fileNames: [blobName],
post_uuid: post_uuid,
route: '/api/post/upload',
formData: fd
Expand Down Expand Up @@ -234,7 +235,7 @@ define('composer/uploads', [
var filenameMapping = [];

for (var i = 0; i < files.length; ++i) {
filenameMapping.push(i + '_' + Date.now() + '_' + files[i].name);
filenameMapping.push(i + '_' + Date.now() + '_' + (params.fileNames ? params.fileNames[i] : files[i].name));
var isImage = files[i].type.match(/image./);

if (files[i].size > parseInt(config.maximumFileSize, 10) * 1024) {
Expand All @@ -257,6 +258,10 @@ define('composer/uploads', [
uploads.inProgress[post_uuid] = uploads.inProgress[post_uuid] || [];
uploads.inProgress[post_uuid].push(1);

if (params.formData) {
params.formData.append('cid', cid);
}

$(this).ajaxSubmit({
headers: {
'x-csrf-token': csrf.get()
Expand Down

0 comments on commit a2dbd83

Please sign in to comment.