1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-23 22:36:32 +02:00

Server: Resolves #5286: Set better filename and mime type for files downloaded via published notes

This commit is contained in:
Laurent Cozic
2021-08-10 19:13:16 +01:00
parent 4b5318c6d0
commit 77cdd3467d
4 changed files with 53 additions and 14 deletions

View File

@@ -15,6 +15,7 @@ describe('pathUtils', function() {
['no space at the end ', 'no space at the end'],
['nor dots...', 'nor dots'],
[' no space before either', 'no space before either'],
['no\nnewline\n\rplease', 'no_newline__please'],
['thatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylong', 'thatsreallylongthatsreallylongthatsreallylongthats'],
];
@@ -25,6 +26,11 @@ describe('pathUtils', function() {
expect(!!friendlySafeFilename('')).toBe(true);
expect(!!friendlySafeFilename('...')).toBe(true);
// Check that it optionally handles filenames with extension
expect(friendlySafeFilename(' testing.md', null, true)).toBe('testing.md');
expect(friendlySafeFilename('testing.safe??ext##', null, true)).toBe('testing.safeext');
expect(friendlySafeFilename('thatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylongthatsreallylong.md', null, true)).toBe('thatsreallylongthatsreallylongthatsreallylongthats.md');
}));
it('should quote and unquote paths', (async () => {