From 91a17fd657ac2165086979a5818e284d4328c42a Mon Sep 17 00:00:00 2001 From: "cbiesinger%web.de" Date: Sat, 29 Jul 2006 05:42:14 +0000 Subject: [PATCH] 118621 r=jag sr=bz http://foo/bar/ default save name should be bar.html --- suite/common/contentAreaUtils.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/suite/common/contentAreaUtils.js b/suite/common/contentAreaUtils.js index d2efc36100d9..6eb9ced969ff 100644 --- a/suite/common/contentAreaUtils.js +++ b/suite/common/contentAreaUtils.js @@ -792,20 +792,27 @@ function getDefaultFileName(aDefaultFileName, aNameFromHeaders, aDocumentURI, aD // 4) Use the caller-provided name, if any return validateFileName(aDefaultFileName); + // 5) If this is a directory, use the last directory name + var re = /\/([^\/]+)\/$/; + var path = aDocumentURI.path.match(re); + if (path && path.length > 1) { + return validateFileName(path[1]); + } + try { if (aDocumentURI.host) - // 5) Use the host. + // 6) Use the host. return aDocumentURI.host; } catch (e) { // Some files have no information at all, like Javascript generated pages } try { - // 6) Use the default file name + // 7) Use the default file name return getStringBundle().GetStringFromName("DefaultSaveFileName"); } catch (e) { //in case localized string cannot be found } - // 7) If all else fails, use "index" + // 8) If all else fails, use "index" return "index"; }