From 607a3f1b7d57b98ed16cdc68c738f3dc793319f0 Mon Sep 17 00:00:00 2001 From: CaS Date: Thu, 16 Jan 2003 15:09:18 +0000 Subject: [PATCH] Compatibility fix. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@15609 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/NSURL.m | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 62b6915a5..e3963927d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-01-16 Richard Frith-Macdonald + + * Source/NSURL.m: Support MacOS-X style initialisation using a path + with a leading slash. + 2003-01-09 Richard Frith-Macdonald * Source/Additions/GSCategories.m: Additional ([weekOfYear]) method diff --git a/Source/NSURL.m b/Source/NSURL.m index c63274f11..7807bc4f0 100644 --- a/Source/NSURL.m +++ b/Source/NSURL.m @@ -528,8 +528,21 @@ static void unescape(const char *from, char * to) { if ([aPath length] > 0) { - aUrlString = [aUrlString initWithFormat: @"%@://%@/%@", - aScheme, aHost, aPath]; + /* + * For MacOS-X compatibility, assume a path component with + * a leading slash is intended to have that slash separating + * the host from the path as specified in the RFC1738 + */ + if ([aPath hasPrefix: @"/"] == YES) + { + aUrlString = [aUrlString initWithFormat: @"%@://%@%@", + aScheme, aHost, aPath]; + } + else + { + aUrlString = [aUrlString initWithFormat: @"%@://%@/%@", + aScheme, aHost, aPath]; + } } else {