Determine fallback filename.
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 12 Nov 2008 06:14:14 +0000 (23:14 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 12 Nov 2008 06:14:14 +0000 (23:14 -0700)
framework/Mime/lib/Horde/Mime/Viewer/rar.php
framework/Mime/lib/Horde/Mime/Viewer/tgz.php

index ed173d3..96751ea 100644 (file)
@@ -60,9 +60,15 @@ class Horde_Mime_Viewer_rar extends Horde_Mime_Viewer_Driver
 
         require_once 'Horde/Text.php';
 
-        $text = '<strong>' . htmlspecialchars(sprintf(_("Contents of \"%s\""), $this->_mimepart->getName(true))) . ':</strong>' . "\n" .
+        $name = $this->_mimepart->getName(true);
+        if (empty($name)) {
+            $name = _("unnamed");
+        }
+
+
+        $text = '<strong>' . htmlspecialchars(sprintf(_("Contents of \"%s\""), $name)) . ':</strong>' . "\n" .
             '<table><tr><td align="left"><tt><span class="fixed">' .
-            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" .
index 3fc6c94..4c8d5c6 100644 (file)
@@ -78,9 +78,14 @@ class Horde_Mime_Viewer_tgz extends Horde_Mime_Viewer_Driver
 
         require_once 'Horde/Text.php';
 
-        $text = '<strong>' . htmlspecialchars(sprintf(_("Contents of \"%s\""), $this->_mimepart->getName(true))) . ':</strong>' . "\n" .
+        $name = $this->_mimepart->getName(true);
+        if (empty($name)) {
+            $name = _("unnamed");
+        }
+
+        $text = '<strong>' . htmlspecialchars(sprintf(_("Contents of \"%s\""), $name)) . ':</strong>' . "\n" .
             '<table><tr><td align="left"><tt><span class="fixed">' .
-            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" .