Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed problem with <a href="">
  • Loading branch information
odrobnik committed May 12, 2011
1 parent 14a6b21 commit a8b1ecf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
9 changes: 8 additions & 1 deletion Classes/NSAttributedString+HTML.m
Expand Up @@ -352,7 +352,14 @@ - (id)initWithHTML:(NSData *)data options:(NSDictionary *)options documentAttrib
// deal with relative URL
if (![link scheme])
{
link = [NSURL URLWithString:cleanString relativeToURL:baseURL];
if ([cleanString length])
{
link = [NSURL URLWithString:cleanString relativeToURL:baseURL];
}
else
{
link = baseURL;
}
}

currentTag.link = link;
Expand Down
12 changes: 10 additions & 2 deletions Classes/NSScanner+HTML.m
Expand Up @@ -131,8 +131,16 @@ - (BOOL)scanHTMLTag:(NSString **)tagName attributes:(NSDictionary **)attributes

if ([self scanCharactersFromSet:quoteCharacterSet intoString:&quote])
{
[self scanUpToString:quote intoString:&attrValue];
[self scanString:quote intoString:NULL];
if ([quote length]==1)
{
[self scanUpToString:quote intoString:&attrValue];
[self scanString:quote intoString:NULL];
}
else
{
// most likely e.g. href=""
attrValue = @"";
}

[tmpAttributes setObject:attrValue forKey:attrName];
}
Expand Down

0 comments on commit a8b1ecf

Please sign in to comment.