Skip to content
Browse files

only referencing css stylesheet if it is local file

  • Loading branch information...
1 parent 02f90a1 commit 93c9a082ad067feac63a363d851e24be7d37c414 @yifan yifan committed
Showing with 7 additions and 4 deletions.
  1. +7 −4 Core/Source/DTHTMLAttributedStringBuilder.m
View
11 Core/Source/DTHTMLAttributedStringBuilder.m
@@ -616,14 +616,17 @@ - (void)_registerTagEndHandlers
void (^linkBlock)(void) = ^
{
- // NSString *ref = [[_currentTag attributeForKey:@"rel"] lowercaseString];
NSString *href = [_currentTag attributeForKey:@"href"];
NSString *type = [[_currentTag attributeForKey:@"type"] lowercaseString];
if ([type isEqualToString:@"text/css"]) {
NSURL *stylesheetURL = [NSURL URLWithString:href relativeToURL:_baseURL];
- NSString *stylesheetContent = [NSString stringWithContentsOfURL:stylesheetURL encoding:NSUTF8StringEncoding error:nil];
- DTCSSStylesheet *localSheet = [[DTCSSStylesheet alloc] initWithStyleBlock:stylesheetContent];
- [_globalStyleSheet mergeStylesheet:localSheet];
+ if ([[stylesheetURL scheme] isEqualToString:@"file"]) {
+ NSString *stylesheetContent = [NSString stringWithContentsOfURL:stylesheetURL encoding:NSUTF8StringEncoding error:nil];
+ if (stylesheetContent) {
+ DTCSSStylesheet *localSheet = [[DTCSSStylesheet alloc] initWithStyleBlock:stylesheetContent];
+ [_globalStyleSheet mergeStylesheet:localSheet];
+ }
+ }
}
};

0 comments on commit 93c9a08

Please sign in to comment.
Something went wrong with that request. Please try again.