Skip to content

Commit 2a7a652

Browse files
author
ArthurHub
committed
minor CorrectRelativeUrls fix
1 parent c8f1642 commit 2a7a652

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

Source/HtmlRenderer/Core/Handlers/StylesheetLoadHandler.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ private static string CorrectRelativeUrls(string stylesheet, Uri baseUri)
155155
int idx = 0;
156156
while (idx >= 0 && idx < stylesheet.Length)
157157
{
158-
idx = stylesheet.IndexOf("url", idx, StringComparison.OrdinalIgnoreCase);
158+
idx = stylesheet.IndexOf("url(", idx, StringComparison.OrdinalIgnoreCase);
159159
if (idx >= 0)
160160
{
161161
int endIdx = stylesheet.IndexOf(')', idx);
@@ -170,8 +170,12 @@ private static string CorrectRelativeUrls(string stylesheet, Uri baseUri)
170170
url = new Uri(baseUri, url);
171171
stylesheet = stylesheet.Remove(idx + 4, endIdx - idx - 4);
172172
stylesheet = stylesheet.Insert(idx + 4, url.AbsoluteUri);
173+
idx += url.AbsoluteUri.Length + 4;
174+
}
175+
else
176+
{
177+
idx = endIdx + 1;
173178
}
174-
idx = endIdx + 1;
175179
}
176180
else
177181
{

0 commit comments

Comments
 (0)