FIX: make sure pasting an image in the composer is considered as an image instead of an attachment

This commit is contained in:
Régis Hanol
2015-01-23 19:17:33 +01:00
parent 256519dddf
commit e6f849f873
2 changed files with 8 additions and 4 deletions

View File

@@ -162,11 +162,12 @@ Discourse.Utilities = {
}
var upload = files[0];
var type = Discourse.Utilities.isAnImage(upload.name) ? 'image' : 'attachment';
// CHROME ONLY: if the image was pasted, sets its name to a default one
if (upload instanceof Blob && !(upload instanceof File) && upload.type === "image/png") { upload.name = "blob.png"; }
var type = Discourse.Utilities.isAnImage(upload.name) ? 'image' : 'attachment';
return Discourse.Utilities.validateUploadedFile(upload, type, bypassNewUserRestriction);
},