aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2024-02-03 18:28:46 +0100
committerThomas Lange <code@nerdmind.de>2024-02-03 18:48:16 +0100
commite70e827767892feeb37e25b456dc5c50203455c6 (patch)
tree63b3e811881668c8c0d151ef6becec04ecc45ab8 /core
parent8803801d5d0443c89e4e325e800ba0c2113885fe (diff)
downloadblog-e70e827767892feeb37e25b456dc5c50203455c6.tar.gz
blog-e70e827767892feeb37e25b456dc5c50203455c6.tar.xz
blog-e70e827767892feeb37e25b456dc5c50203455c6.zip
Hotfix: Replace `"` with `'` in link title string
Because there currently is no sane way to escape double quotes within a string intended to be used as title for a Markdown formatted link, just replace the double with single quotes until a better solution is found. Note: Just replacing with `&quot;` will not work here because Parsedown escapes this further to `&amp;quot;`.
Diffstat (limited to 'core')
-rw-r--r--core/functions.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/core/functions.php b/core/functions.php
index bf04ccc..7384c88 100644
--- a/core/functions.php
+++ b/core/functions.php
@@ -312,11 +312,20 @@ function getEntityMarkdownLink($ns, $id, $text = NULL, $info = NULL): string {
return sprintf('`{%s: *Reference error*}`', strtoupper($ns));
}
- $title = htmlspecialchars($Entity->get('name') ?? $Entity->get('fullname'));
+ $title = $Entity->get('name') ?? $Entity->get('fullname');
$href = Application::getEntityURL($Entity);
$text = $text ?: "»{$title}«";
- $info = $info ?: sprintf('%s »%s«',
- Application::getLanguage()->text(strtolower($ns)), $title);
+
+ if($info === NULL) {
+ $info = sprintf('%s »%s«',
+ Application::getLanguage()->text(strtolower($ns)),
+ $title);
+ }
+
+ # Hotfix: Replace double quotes with single quotes because currently we
+ # have no sane way to escape double quotes in a string intended to be
+ # used as the title for a Markdown formatted link.
+ $info = str_replace('"', "'", $info);
return sprintf('[%s](%s "%s")', $text, $href, $info);
}