Fix bug # 48320: Directories displayed twice in file:/// URLs. r=me

This commit is contained in:
rjc%netscape.com 2000-08-22 01:26:42 +00:00
Родитель 4cf2feb015
Коммит ff4cf79e0a
2 изменённых файлов: 16 добавлений и 12 удалений

Просмотреть файл

@ -48,22 +48,26 @@ function Init()
{ {
debug("directory.js: Init()\n"); debug("directory.js: Init()\n");
var tree = document.getElementById('tree');
// Initialize the tree's base URL to whatever the HTTPIndex is rooted at // Initialize the tree's base URL to whatever the HTTPIndex is rooted at
var baseURI = HTTPIndex.BaseURL; var baseURI = HTTPIndex.BaseURL;
if (baseURI && (baseURI.indexOf("ftp://") == 0))
{
// fix bug # 37102: if its a FTP directory // fix bug # 37102: if its a FTP directory
// ensure it ends with a trailing slash // ensure it ends with a trailing slash
if (baseURI && (baseURI.indexOf("ftp://") == 0) && if (baseURI.substr(baseURI.length - 1) != "/")
(baseURI.substr(baseURI.length - 1) != "/"))
{ {
debug("append traiing slash to FTP directory URL\n"); debug("append traiing slash to FTP directory URL\n");
baseURI += "/"; baseURI += "/";
} }
debug("base URL = " + baseURI + "\n");
// Note: Add the HTTPIndex datasource into the tree // Note: DON'T add the HTTPIndex datasource into the tree
var tree = document.getElementById('tree'); // for file URLs, only do it for FTP URLs; the "rdf:files"
// datasources handles file URLs
tree.database.AddDataSource(HTTPIndex.DataSource); tree.database.AddDataSource(HTTPIndex.DataSource);
}
// Note: set encoding BEFORE setting "ref" (important!) // Note: set encoding BEFORE setting "ref" (important!)
var RDF = Components.classes["component://netscape/rdf/rdf-service"].getService(); var RDF = Components.classes["component://netscape/rdf/rdf-service"].getService();

Просмотреть файл

@ -37,7 +37,7 @@
<script src="chrome://communicator/content/directory/directory.js"></script> <script src="chrome://communicator/content/directory/directory.js"></script>
<tree id="tree" datasources="rdf:files" flex="1" style="height:0px;" <tree id="tree" datasources="rdf:files" flex="1" style="height:0px;"
container="true" open="true" container="true" open="true" flags="dont-test-empty"
ondraggesture="return BeginDragTree(event);"> ondraggesture="return BeginDragTree(event);">
<template> <template>
<treechildren flex="1"> <treechildren flex="1">