mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
* md importer: decode uri encoded links to cover case of special chars in linked image names * md importer: temp debug logs for linux test pipeline * md importer: more temp debug logs * md importer: tests, add special char image name on linux * md importer: tests, use const not let * md importer: remove debug logs
This commit is contained in:
parent
ae73051797
commit
37158fdb89
@ -38,4 +38,9 @@ describe('InteropService_Importer_Md: importLocalImages', function() {
|
||||
expect(items.length).toBe(0);
|
||||
expect(note.body).toContain('Unidentified vessel travelling at sub warp speed, bearing 235.7. Fluctuations in energy readings from it, Captain. All transporters off.');
|
||||
});
|
||||
it('should import linked image with special characters in name', async function() {
|
||||
const note = await importer.importFile(`${__dirname}/md_to_md/sample-special-chars.md`, 'notebook');
|
||||
const items = await Note.linkedItems(note.body);
|
||||
expect(items.length).toBe(1);
|
||||
});
|
||||
});
|
||||
|
1
CliClient/tests/md_to_md/sample-special-chars.md
Normal file
1
CliClient/tests/md_to_md/sample-special-chars.md
Normal file
@ -0,0 +1 @@
|
||||
![link special chars](../support/photo-åäö.jpg)
|
BIN
CliClient/tests/support/photo-åäö.jpg
Normal file
BIN
CliClient/tests/support/photo-åäö.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
BIN
CliClient/tests/support/photo-åäö.jpg
Normal file
BIN
CliClient/tests/support/photo-åäö.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
@ -63,7 +63,8 @@ class InteropService_Importer_Md extends InteropService_Importer_Base {
|
||||
async importLocalImages(filePath, md) {
|
||||
let updated = md;
|
||||
const imageLinks = unique(extractImageUrls(md));
|
||||
await Promise.all(imageLinks.map(async (link) => {
|
||||
await Promise.all(imageLinks.map(async (encodedLink) => {
|
||||
const link = decodeURI(encodedLink);
|
||||
const attachmentPath = filename(`${dirname(filePath)}/${link}`, true);
|
||||
const pathWithExtension = `${attachmentPath}.${fileExtension(link)}`;
|
||||
const stat = await shim.fsDriver().stat(pathWithExtension);
|
||||
|
Loading…
Reference in New Issue
Block a user