The solution was to make KURL::lastPathComponent ignore trailing
slashes, which is what -[NSURL lastPathComponent] does, too.
Reviewed by Oliver.
* platform/KURL.cpp:
(WebCore::KURL::lastPathComponent):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@23779
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-06-25 Adam Roben <aroben@apple.com>
+
+ Fix Bug 14402: Main resource of http://www.apple.com/safari/ is called "www.apple.com" instead of "safari"
+ http://bugs.webkit.org/show_bug.cgi?id=14402
+
+ The solution was to make KURL::lastPathComponent ignore trailing
+ slashes, which is what -[NSURL lastPathComponent] does, too.
+
+ Reviewed by Oliver.
+
+ * platform/KURL.cpp:
+ (WebCore::KURL::lastPathComponent):
+
2007-06-25 Sam Weinig <sam@webkit.org>
Reviewed by Adam Roben.
if (!hasPath())
return DeprecatedString();
- int start = urlString.findRev('/', pathEndPos);
- return urlString.mid(start + 1, pathEndPos - start - 1);
+ int end = pathEndPos - 1;
+ if (urlString[end] == '/')
+ --end;
+
+ int start = urlString.findRev('/', end);
+ if (start < portEndPos)
+ return DeprecatedString();
+ ++start;
+
+ return urlString.mid(start, end - start + 1);
}
DeprecatedString KURL::protocol() const