aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2025-06-19 08:26:31 +0000
committerMario <mario@mariovavti.com>2025-06-19 08:26:31 +0000
commit7320149fd87ce60a716470c2b0f3141029ca37ec (patch)
tree0c70b12e8e208170114a86b09c32badeb37b9c83
parent7766e5d42029e6a9211aeb0e9e3eed6ae3c78bbb (diff)
downloadvolse-hubzilla-7320149fd87ce60a716470c2b0f3141029ca37ec.tar.gz
volse-hubzilla-7320149fd87ce60a716470c2b0f3141029ca37ec.tar.bz2
volse-hubzilla-7320149fd87ce60a716470c2b0f3141029ca37ec.zip
only show the pin if we display the label and fix the test
-rw-r--r--include/bbcode.php4
-rw-r--r--tests/unit/includes/BBCodeTest.php2
2 files changed, 3 insertions, 3 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 296693580..d5e1bafd9 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -1350,8 +1350,8 @@ function bbcode($text, $options = []) {
function ($matches) {
$before = $matches[1];
$geo_uri = $matches[2];
- $label = ((!empty($matches[4])) ? urldecode($matches[4]) : $geo_uri);
- return $before . '<a href="' . htmlspecialchars($geo_uri) . '" target="_blank" rel="nofollow noopener">📍' . htmlspecialchars($label) . '</a>';
+ $label = ((!empty($matches[4])) ? '📍' . urldecode($matches[4]) : $geo_uri);
+ return $before . '<a href="' . htmlspecialchars($geo_uri) . '" target="_blank" rel="nofollow noopener">' . htmlspecialchars($label) . '</a>';
},
$text
);
diff --git a/tests/unit/includes/BBCodeTest.php b/tests/unit/includes/BBCodeTest.php
index 6c2bc9059..982ef4eb9 100644
--- a/tests/unit/includes/BBCodeTest.php
+++ b/tests/unit/includes/BBCodeTest.php
@@ -170,7 +170,7 @@ class BBCodeTest extends UnitTestCase {
],
'naked geo uri with label is converted to link' => [
'example url: geo:37.78918,-122.40335(Wikimedia+Foundation)',
- 'example url: <a href="geo:37.78918,-122.40335(Wikimedia+Foundation)" target="_blank" rel="nofollow noopener">Wikimedia Foundation</a>'
+ 'example url: <a href="geo:37.78918,-122.40335(Wikimedia+Foundation)" target="_blank" rel="nofollow noopener">📍Wikimedia Foundation</a>'
],
];
}