From: Michael M Slusarz Date: Wed, 12 Nov 2008 06:14:14 +0000 (-0700) Subject: Determine fallback filename. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=9b6ee65925d9c78f66d072bba4f68fbb9b9ed747;p=horde.git Determine fallback filename. --- diff --git a/framework/Mime/lib/Horde/Mime/Viewer/rar.php b/framework/Mime/lib/Horde/Mime/Viewer/rar.php index ed173d325..96751eab3 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/rar.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/rar.php @@ -60,9 +60,15 @@ class Horde_Mime_Viewer_rar extends Horde_Mime_Viewer_Driver require_once 'Horde/Text.php'; - $text = '' . htmlspecialchars(sprintf(_("Contents of \"%s\""), $this->_mimepart->getName(true))) . ':' . "\n" . + $name = $this->_mimepart->getName(true); + if (empty($name)) { + $name = _("unnamed"); + } + + + $text = '' . htmlspecialchars(sprintf(_("Contents of \"%s\""), $name)) . ':' . "\n" . '
' . - Text::htmlAllSpaces(_("Archive Name") . ': ' . $this->_mimepart->getName(true)) . "\n" . + Text::htmlAllSpaces(_("Archive Name") . ': ' . $name) . "\n" . Text::htmlAllSpaces(_("Archive File Size") . ': ' . strlen($contents) . ' bytes') . "\n" . Text::htmlAllSpaces(sprintf(ngettext("File Count: %d file", "File Count: %d files", $fileCount), $fileCount)) . "\n\n" . diff --git a/framework/Mime/lib/Horde/Mime/Viewer/tgz.php b/framework/Mime/lib/Horde/Mime/Viewer/tgz.php index 3fc6c9480..4c8d5c63a 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/tgz.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/tgz.php @@ -78,9 +78,14 @@ class Horde_Mime_Viewer_tgz extends Horde_Mime_Viewer_Driver require_once 'Horde/Text.php'; - $text = '' . htmlspecialchars(sprintf(_("Contents of \"%s\""), $this->_mimepart->getName(true))) . ':' . "\n" . + $name = $this->_mimepart->getName(true); + if (empty($name)) { + $name = _("unnamed"); + } + + $text = '' . htmlspecialchars(sprintf(_("Contents of \"%s\""), $name)) . ':' . "\n" . '
' . - Text::htmlAllSpaces(_("Archive Name") . ': ' . $this->_mimepart->getName(true)) . "\n" . + Text::htmlAllSpaces(_("Archive Name") . ': ' . $name) . "\n" . Text::htmlAllSpaces(_("Archive File Size") . ': ' . strlen($contents) . ' bytes') . "\n" . Text::htmlAllSpaces(sprintf(ngettext("File Count: %d file", "File Count: %d files", $fileCount), $fileCount)) . "\n\n" .