FIX: Image file names with dots were showing incorrectly in composer markdown (#8465)

When uploading an image file with dots in the filename we were splitting the string on dots and getting the last of the split items as the extension-less filename. However this did not work with filenames that have dots. We now  just remove the extension using substr.
This commit is contained in:
Martin Brennan
2019-12-06 10:58:47 +10:00
committed by GitHub
parent da2b0b2882
commit e4881290be
2 changed files with 20 additions and 13 deletions

View File

@ -205,6 +205,11 @@ QUnit.test("getUploadMarkdown", assert => {
"![file name with space|100x200](/uploads/123/abcdef.ext)"
);
assert.equal(
testUploadMarkdown("image.file.name.with.dots.png"),
"![image.file.name.with.dots|100x200](/uploads/123/abcdef.ext)"
);
const short_url = "uploads://asdaasd.ext";
assert.equal(
@ -213,15 +218,18 @@ QUnit.test("getUploadMarkdown", assert => {
);
});
QUnit.test("replaces GUID in image alt text on iOS", assert => {
assert.equal(
testUploadMarkdown("8F2B469B-6B2C-4213-BC68-57B4876365A0.jpeg"),
"![8F2B469B-6B2C-4213-BC68-57B4876365A0|100x200](/uploads/123/abcdef.ext)"
);
QUnit.test(
"getUploadMarkdown - replaces GUID in image alt text on iOS",
assert => {
assert.equal(
testUploadMarkdown("8F2B469B-6B2C-4213-BC68-57B4876365A0.jpeg"),
"![8F2B469B-6B2C-4213-BC68-57B4876365A0|100x200](/uploads/123/abcdef.ext)"
);
sandbox.stub(Utilities, "isAppleDevice").returns(true);
assert.equal(
testUploadMarkdown("8F2B469B-6B2C-4213-BC68-57B4876365A0.jpeg"),
"![image|100x200](/uploads/123/abcdef.ext)"
);
});
sandbox.stub(Utilities, "isAppleDevice").returns(true);
assert.equal(
testUploadMarkdown("8F2B469B-6B2C-4213-BC68-57B4876365A0.jpeg"),
"![image|100x200](/uploads/123/abcdef.ext)"
);
}
);