diff options
author | Mario Vavti <mario@mariovavti.com> | 2023-06-02 13:30:21 +0200 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2023-06-02 13:35:39 +0200 |
commit | 1b0e26841610a4ac954b24cc98ff6690018ca2cd (patch) | |
tree | 2415ad109292e171ffdefc593baca48b6cd1fbbb /include | |
parent | 1a27fad9b97ba76991e268d933ed6edae13748a1 (diff) | |
download | volse-hubzilla-1b0e26841610a4ac954b24cc98ff6690018ca2cd.tar.gz volse-hubzilla-1b0e26841610a4ac954b24cc98ff6690018ca2cd.tar.bz2 volse-hubzilla-1b0e26841610a4ac954b24cc98ff6690018ca2cd.zip |
fix theme_attachments()
(cherry picked from commit 65a472c113b0ad93465e2698fafe388e739bdacb)
Diffstat (limited to 'include')
-rw-r--r-- | include/text.php | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/include/text.php b/include/text.php index aadca80e1..2693e7b16 100644 --- a/include/text.php +++ b/include/text.php @@ -1543,7 +1543,6 @@ function link_compare($a, $b) { function theme_attachments(&$item) { - $s = ''; $arr = json_decode($item['attach'],true); @@ -1557,15 +1556,25 @@ function theme_attachments(&$item) { $label = ''; - if(isset($r['title'])) + if(isset($r['name'])) { + $label = urldecode(htmlspecialchars($r['name'], ENT_COMPAT, 'UTF-8')); + } + + if(! $label && isset($r['title'])) { $label = urldecode(htmlspecialchars($r['title'], ENT_COMPAT, 'UTF-8')); + } - if(! $label && isset($r['href'])) - $label = basename($r['href']); + if(!$label && isset($r['href'])) { + $m = parse_url($r['href']); + if ($m && $m['path']) { + $label = basename($m['path']); + } + } //some feeds provide an attachment where title an empty space - if(! $label || $label == ' ') - $label = t('Unknown Attachment'); + if(!trim($label)) { + $label = t('Unknown attachment'); + } $title = t('Size') . ' ' . (isset($r['length']) ? userReadableSize($r['length']) : t('unknown')); @@ -1594,7 +1603,6 @@ function theme_attachments(&$item) { return $s; } - function format_categories(&$item,$writeable) { $s = ''; |