[Dojo-checkins] r914 - src/uri
dojo-checkins at dojotoolkit.org
dojo-checkins at dojotoolkit.org
Mon Jul 18 16:33:30 PDT 2005
Author: psowden
Date: Mon Jul 18 16:33:28 2005
New Revision: 914
Modified:
src/uri/Uri.js
Log:
should now pass all my unit tests!
Modified: src/uri/Uri.js
==============================================================================
--- src/uri/Uri.js (original)
+++ src/uri/Uri.js Mon Jul 18 16:33:28 2005
@@ -46,11 +46,17 @@
if (relobj.path.charAt(0) != "/") {
var path = uriobj.path.substring(0,
uriobj.path.lastIndexOf("/") + 1) + relobj.path;
+
var segs = path.split("/");
for (var j = 0; j < segs.length; j++) {
- if (segs[j] == ".") { segs.splice(j, 1); j--; }
- else if (j != 0 && segs[j] == ".." && segs[j-1] != "..") {
- segs.splice(j - 1, 2); j -= 2;
+ if (segs[j] == ".") {
+ if (j == segs.length - 1) { segs[j] = ""; }
+ else { segs.splice(j, 1); j--; }
+ } else if (j > 0 && !(j == 1 && segs[0] == "") &&
+ segs[j] == ".." && segs[j-1] != "..")
+ {
+ if (j == segs.length - 1) { segs.splice(j, 1); segs[j - 1] = ""; }
+ else { segs.splice(j - 1, 2); j -= 2; }
}
}
relobj.path = segs.join("/");
More information about the Dojo-checkins
mailing list