* GSWeb/GSWHyperlink.m

fix -appendAttribute:... for nil href value


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@37974 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Manuel Guesdon 2014-07-01 14:11:26 +00:00
parent e32a81eb7e
commit 03d83ffad3
2 changed files with 50 additions and 48 deletions

View file

@ -1,3 +1,6 @@
2014-07-01 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb/GSWHyperlink.m
fix -appendAttribute:... for nil href value
2014-06-11 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb/GSWAssociation.m
fix EOValidatedObjectUserInfoKey value

View file

@ -366,70 +366,69 @@ static Class NSStringClass = Nil;
GSWResponse_appendContentCharacter(response,'"');
}
else if (_href != nil)
else
{
NSString* hrefValue = nil;
GSWComponent * component = GSWContext_component(context);
NSString* hrefValue = [_href valueInComponent:component];
if (hrefValue==nil)
hrefValue=@"";
else
hrefValue=NSStringWithObject(hrefValue);
GSWResponse_appendContentCharacter(response,' ');
GSWResponse_appendContentAsciiString(response,href__Key);
GSWResponse_appendContentCharacter(response,'=');
GSWResponse_appendContentCharacter(response,'"');
if ([hrefValue isRelativeURL]
&& ![hrefValue isFragmentURL])
if (_href != nil
&& (hrefValue = [_href valueInComponent:component]) != nil)
{
NSString * url = [context _urlForResourceNamed:hrefValue
inFramework:nil];
if (url != nil)
GSWResponse_appendContentString(response,url);
else
{
GSWResponse_appendContentAsciiString(response,[component baseURL]);
GSWResponse_appendContentCharacter(response,'/');
GSWResponse_appendContentString(response,hrefValue);
}
}
else
{
GSWResponse_appendContentString(response,hrefValue);
}
hrefValue = NSStringWithObject(hrefValue);
[self _appendQueryStringToResponse:response
inContext:context
requestHandlerPath:nil
htmlEscapeURL:YES];
[self _appendFragmentToResponse: response
inContext:context];
GSWResponse_appendContentCharacter(response,'"');
}
else if (_fragmentIdentifier != nil)
{
GSWComponent * component = GSWContext_component(context);
id fragmentIdentifierValue = [_fragmentIdentifier valueInComponent:component];
if (fragmentIdentifierValue != nil)
{
GSWResponse_appendContentCharacter(response,' ');
GSWResponse_appendContentAsciiString(response,href__Key);
GSWResponse_appendContentCharacter(response,'=');
GSWResponse_appendContentCharacter(response,'"');
if ([hrefValue isRelativeURL]
&& ![hrefValue isFragmentURL])
{
NSString * url = [context _urlForResourceNamed:hrefValue
inFramework:nil];
if (url != nil)
GSWResponse_appendContentString(response,url);
else
{
GSWResponse_appendContentAsciiString(response,[component baseURL]);
GSWResponse_appendContentCharacter(response,'/');
GSWResponse_appendContentString(response,hrefValue);
}
}
else
{
GSWResponse_appendContentString(response,hrefValue);
}
[self _appendQueryStringToResponse:response
inContext:context
requestHandlerPath:nil
htmlEscapeURL:YES];
GSWResponse_appendContentCharacter(response,'#');
GSWResponse_appendContentString(response,NSStringWithObject(fragmentIdentifierValue));
[self _appendFragmentToResponse: response
inContext:context];
GSWResponse_appendContentCharacter(response,'"');
}
else if (_fragmentIdentifier != nil)
{
id fragmentIdentifierValue = [_fragmentIdentifier valueInComponent:component];
if (fragmentIdentifierValue != nil)
{
GSWResponse_appendContentCharacter(response,' ');
GSWResponse_appendContentAsciiString(response,href__Key);
GSWResponse_appendContentCharacter(response,'=');
GSWResponse_appendContentCharacter(response,'"');
[self _appendQueryStringToResponse:response
inContext:context
requestHandlerPath:nil
htmlEscapeURL:YES];
GSWResponse_appendContentCharacter(response,'#');
GSWResponse_appendContentString(response,NSStringWithObject(fragmentIdentifierValue));
GSWResponse_appendContentCharacter(response,'"');
}
}
}
}