FIX: uploading a file with a non-ASCII character wasn't removing the placeholder

This commit is contained in:
Régis Hanol 2015-09-21 16:17:25 +02:00
parent 16a06233ca
commit af7f00099f
1 changed files with 4 additions and 4 deletions

View File

@ -342,9 +342,9 @@ const ComposerView = Ember.View.extend(Ember.Evented, {
this.messageBus.subscribe("/uploads/composer", upload => { this.messageBus.subscribe("/uploads/composer", upload => {
if (!cancelledByTheUser) { if (!cancelledByTheUser) {
if (upload && upload.url) { if (upload && upload.url) {
const old = Discourse.Utilities.getUploadPlaceholder(upload.original_filename), const regex = new RegExp(`\\[${I18n.t("uploading")}.+?\\]\\(\\)`),
markdown = Discourse.Utilities.getUploadMarkdown(upload); markdown = Discourse.Utilities.getUploadMarkdown(upload);
this.replaceMarkdown(old, markdown); this.replaceMarkdown(regex, markdown);
} else { } else {
Discourse.Utilities.displayErrorForUpload(upload); Discourse.Utilities.displayErrorForUpload(upload);
} }
@ -527,9 +527,9 @@ const ComposerView = Ember.View.extend(Ember.Evented, {
}); });
}, },
replaceMarkdown(old, text) { replaceMarkdown(regex, text) {
const reply = this.get("model.reply"); const reply = this.get("model.reply");
this.set("model.reply", reply.replace(old, text)); this.set("model.reply", reply.replace(regex, text));
}, },
// Uses javascript to get the image sizes from the preview, if present // Uses javascript to get the image sizes from the preview, if present