mirror of
https://github.com/discourse/discourse.git
synced 2025-02-06 21:51:45 +08:00
FIX: uploading a file with a non-ASCII character wasn't removing the placeholder
This commit is contained in:
parent
16a06233ca
commit
af7f00099f
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user