mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-07 20:04:32 +02:00
Duplicate names attachments
Problem: The browser view for attachments displayed the attachment name twice. With the change, only the filename is shown, which improves clarity.
This commit is contained in:
parent
544b926c9e
commit
15eb21378e
1 changed files with 17 additions and 12 deletions
|
@ -56,6 +56,7 @@ class Browser extends BaseModule
|
|||
$fileArray = array_map([$this, 'map_files'], $files);
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('media/browser.tpl');
|
||||
|
||||
$output = Renderer::replaceMacros($tpl, [
|
||||
'$type' => 'attachment',
|
||||
'$path' => ['' => $this->t('Files')],
|
||||
|
@ -76,12 +77,16 @@ class Browser extends BaseModule
|
|||
protected function map_files(array $record): array
|
||||
{
|
||||
list($m1, $m2) = explode('/', $record['filetype']);
|
||||
$filetype = file_exists(sprintf('images/icons/%s.png', $m1) ? $m1 : 'text');
|
||||
$filetype = file_exists('images/icons/' . $m1 . '.png') ? $m1 : 'text';
|
||||
$iconUrl = sprintf('%s/images/icon/16/%s.png', $this->baseUrl, $filetype);
|
||||
$fileUrl = sprintf('%s/attach/%s', $this->baseUrl, $record['id']);
|
||||
|
||||
// Erstellen Sie ein Array mit den notwendigen Informationen
|
||||
return [
|
||||
sprintf('%s/attach/%s', $this->baseUrl, $record['id']),
|
||||
$record['filename'],
|
||||
sprintf('%s/images/icon/16/%s.png', $this->baseUrl, $filetype),
|
||||
$fileUrl, // $f.0
|
||||
$record['filename'], // $f.1
|
||||
$iconUrl, // $f.2
|
||||
$record['filename'] // $f.3
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue