From ff4cf79e0a7b51ad824590c30de032796aed5b42 Mon Sep 17 00:00:00 2001 From: "rjc%netscape.com" Date: Tue, 22 Aug 2000 01:26:42 +0000 Subject: [PATCH] Fix bug # 48320: Directories displayed twice in file:/// URLs. r=me --- xpfe/components/directory/directory.js | 26 ++++++++++++++----------- xpfe/components/directory/directory.xul | 2 +- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/xpfe/components/directory/directory.js b/xpfe/components/directory/directory.js index 80ec5c58ca01..8c195062d41a 100644 --- a/xpfe/components/directory/directory.js +++ b/xpfe/components/directory/directory.js @@ -48,22 +48,26 @@ function Init() { debug("directory.js: Init()\n"); + var tree = document.getElementById('tree'); + // Initialize the tree's base URL to whatever the HTTPIndex is rooted at var baseURI = HTTPIndex.BaseURL; - // fix bug # 37102: if its a FTP directory - // ensure it ends with a trailing slash - if (baseURI && (baseURI.indexOf("ftp://") == 0) && - (baseURI.substr(baseURI.length - 1) != "/")) + if (baseURI && (baseURI.indexOf("ftp://") == 0)) { - debug("append traiing slash to FTP directory URL\n"); - baseURI += "/"; - } - debug("base URL = " + baseURI + "\n"); + // fix bug # 37102: if its a FTP directory + // ensure it ends with a trailing slash + if (baseURI.substr(baseURI.length - 1) != "/") + { + debug("append traiing slash to FTP directory URL\n"); + baseURI += "/"; + } - // Note: Add the HTTPIndex datasource into the tree - var tree = document.getElementById('tree'); - tree.database.AddDataSource(HTTPIndex.DataSource); + // Note: DON'T add the HTTPIndex datasource into the tree + // for file URLs, only do it for FTP URLs; the "rdf:files" + // datasources handles file URLs + tree.database.AddDataSource(HTTPIndex.DataSource); + } // Note: set encoding BEFORE setting "ref" (important!) var RDF = Components.classes["component://netscape/rdf/rdf-service"].getService(); diff --git a/xpfe/components/directory/directory.xul b/xpfe/components/directory/directory.xul index 34a4e0964a65..a41bf185eaeb 100644 --- a/xpfe/components/directory/directory.xul +++ b/xpfe/components/directory/directory.xul @@ -37,7 +37,7 @@