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

Desktop: Allow attaching a file from the Markdown editor for HTML notes

This commit is contained in:
Laurent Cozic
2023-10-31 16:53:47 +00:00
parent a95a66104d
commit a7dddaf2c4
13 changed files with 73 additions and 21 deletions

View File

@@ -159,12 +159,14 @@ class HtmlUtils {
.replace(/</g, '&lt;');
}
// This is tested in sanitize_links.md
private isAcceptedUrl(url: string, allowedFilePrefixes: string[]): boolean {
url = url.toLowerCase();
if (url.startsWith('https://') ||
url.startsWith('http://') ||
url.startsWith('mailto://') ||
url.startsWith('mailto:') ||
url.startsWith('joplin://') ||
!!url.match(/:\/[0-9a-zA-Z]{32}/) ||
// We also allow anchors but only with a specific set of a characters.
// Fixes https://github.com/laurent22/joplin/issues/8286
!!url.match(/^#[a-zA-Z0-9-]+$/)) return true;