diff options
author | Mario Vavti <mario@mariovavti.com> | 2023-06-02 13:30:21 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2023-06-02 13:30:21 +0200 |
commit | 65a472c113b0ad93465e2698fafe388e739bdacb (patch) | |
tree | 259e7a7cac56de461ed6f7a867dbb09b5bc0e4c2 /include/text.php | |
parent | 396b124e84109655f7e4587589ada8044f034bfa (diff) | |
download | volse-hubzilla-65a472c113b0ad93465e2698fafe388e739bdacb.tar.gz volse-hubzilla-65a472c113b0ad93465e2698fafe388e739bdacb.tar.bz2 volse-hubzilla-65a472c113b0ad93465e2698fafe388e739bdacb.zip |
fix theme_attachments()
Diffstat (limited to 'include/text.php')
-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 = ''; |