mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
All: Fixes #8286: Allow certain HTML anchor tags
This commit is contained in:
parent
0c6f779aab
commit
98440beffa
1
packages/app-cli/tests/md_to_html/sanitize_17.html
Normal file
1
packages/app-cli/tests/md_to_html/sanitize_17.html
Normal file
@ -0,0 +1 @@
|
||||
<a href="#top" class="jop-noMdConv">⬆️</a>
|
1
packages/app-cli/tests/md_to_html/sanitize_17.md
Normal file
1
packages/app-cli/tests/md_to_html/sanitize_17.md
Normal file
@ -0,0 +1 @@
|
||||
<a href="#top">⬆️</a>
|
@ -157,7 +157,12 @@ class HtmlUtils {
|
||||
|
||||
private isAcceptedUrl(url: string): boolean {
|
||||
url = url.toLowerCase();
|
||||
return url.startsWith('https://') || url.startsWith('http://') || url.startsWith('mailto://');
|
||||
return url.startsWith('https://') ||
|
||||
url.startsWith('http://') ||
|
||||
url.startsWith('mailto://') ||
|
||||
// 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-]+$/);
|
||||
}
|
||||
|
||||
public sanitizeHtml(html: string, options: SanitizeHtmlOptions = null) {
|
||||
|
Loading…
Reference in New Issue
Block a user