File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -597,10 +597,12 @@ - (NSArray *)getTextAndStylesFromHtml:(NSString *)fixedHtml {
597597 } else if ([tagName isEqualToString: @" code" ]) {
598598 [styleArr addObject: @([InlineCodeStyle getStyleType ])];
599599 } else if ([tagName isEqualToString: @" a" ]) {
600- [styleArr addObject: @([LinkStyle getStyleType ])];
601- // cut only the url from the href="..." string
602- NSString *url = [params substringWithRange: NSMakeRange (6 , params.length - 7 )];
603- stylePair.styleValue = url;
600+ [styleArr addObject: @([LinkStyle getStyleType ])];
601+ NSRange hrefRange = [params rangeOfString: @" href=" ];
602+ if (hrefRange.location != NSNotFound ) {
603+ NSString *url = [params substringWithRange: NSMakeRange (6 , params.length - 7 )];
604+ stylePair.styleValue = url;
605+ }
604606 } else if ([tagName isEqualToString: @" mention" ]) {
605607 [styleArr addObject: @([MentionStyle getStyleType ])];
606608 // extract html expression into dict using some regex
You can’t perform that action at this time.
0 commit comments