OSX compatibility when we are creating a URL relative to an incompatible base.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36102 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2013-02-10 06:24:56 +00:00
parent 35e931398b
commit d4f1581679
2 changed files with 18 additions and 11 deletions

View file

@ -1,3 +1,9 @@
2013-02-10 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSURL.m: For OSX compatibility, if we are creating a relative
URL and the base URL has a different scheme from the base, then we
ignore the base URL rather than raising an exception.
2013-02-03 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSThread.m: Fix error in check for perform on finished thread.

View file

@ -868,20 +868,20 @@ static NSUInteger urlAlign;
*ptr = tolower(*ptr);
}
}
if (base != 0 && base->scheme != 0
&& strcmp(base->scheme, buf->scheme) != 0)
{
[NSException raise: NSInvalidArgumentException
format: @"[%@ %@](%@, %@) "
@"scheme of base and relative parts does not match",
NSStringFromClass([self class]),
NSStringFromSelector(_cmd),
aUrlString, aBaseUrl];
}
}
}
start = end;
if (buf->scheme != 0 && base != 0
&& 0 != strcmp(buf->scheme, base->scheme))
{
/* The relative URL is of a different scheme to the base ...
* so it's actually an absolute URL without a base.
*/
DESTROY(_baseURL);
base = 0;
}
if (buf->scheme == 0 && base != 0)
{
buf->scheme = base->scheme;
@ -896,7 +896,8 @@ static NSUInteger urlAlign;
{
buf->isFile = YES;
}
else if (strcmp(buf->scheme, "mailto") == 0)
else if (strcmp(buf->scheme, "data") == 0
|| strcmp(buf->scheme, "mailto") == 0)
{
usesFragments = NO;
usesParameters = NO;