Skip to content
This repository was archived by the owner on Apr 7, 2024. It is now read-only.

Commit bf93fe7

Browse files
committed
Add support for # in resource urls
issue #68
1 parent bbc955e commit bf93fe7

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Services/CssDependencyService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace StaticWebEpiserverPlugin.Services
88
{
99
public class CssDependencyService : ITextResourceDependencyService
1010
{
11-
static readonly Regex REGEX_FIND_URL_REFERENCE = new Regex("url\\([\"|']{0,1}(?<resource>[^[\\)\"|']+)", RegexOptions.Compiled);
11+
static readonly Regex REGEX_FIND_URL_REFERENCE = new Regex("url\\([\"']{0,1}(?<resource>[^[\\)\"'#]+)", RegexOptions.Compiled);
1212

1313
public string EnsureDependencies(string referencingUrl, string content, IStaticWebService staticWebService, SiteConfigurationElement configuration, bool? useTemporaryAttribute, bool ignoreHtmlDependencies, Dictionary<string, string> currentPageResourcePairs = null, ConcurrentDictionary<string, string> replaceResourcePairs = null, int callDepth = 0)
1414
{

Services/HtmlDependencyService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ namespace StaticWebEpiserverPlugin.Services
99
{
1010
public class HtmlDependencyService : ITextResourceDependencyService
1111
{
12-
static readonly Regex REGEX_FIND_SOURCE_REFERENCE = new Regex("<(source).*(srcset)=[\"|'](?<imageCandidates>[^\"|']+)[\"|']", RegexOptions.Compiled);
12+
static readonly Regex REGEX_FIND_SOURCE_REFERENCE = new Regex("<(source).*(srcset)=[\"'](?<imageCandidates>[^\"']+)[\"'#]", RegexOptions.Compiled);
1313
static readonly Regex REGEX_FIND_SOURCE_RESOUCE_REFERENCE = new Regex("(?<resource>[^, ]+)( [0-9.]+[w|x][,]{0,1})*", RegexOptions.Compiled);
14-
static readonly Regex REGEX_FIND_SCRIPT_OR_LINK_OR_IMG_OR_A_URL_REFERENCE = new Regex("<(script|link|img|a).*(href|src)=[\"|'](?<resource>[^\"|']+)", RegexOptions.Compiled);
14+
static readonly Regex REGEX_FIND_SCRIPT_OR_LINK_OR_IMG_OR_A_URL_REFERENCE = new Regex("<(script|link|img|a).*(href|src)=[\"'](?<resource>[^\"'#]+)", RegexOptions.Compiled);
1515

1616
public string EnsureDependencies(string referencingUrl, string content, IStaticWebService staticWebService, SiteConfigurationElement configuration, bool? useTemporaryAttribute, bool ignoreHtmlDependencies, Dictionary<string, string> currentPageResourcePairs = null, ConcurrentDictionary<string, string> replaceResourcePairs = null, int callDepth = 0)
1717
{

Services/SvgDependencyService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace StaticWebEpiserverPlugin.Services
99
{
1010
public class SvgDependencyService : ITextResourceDependencyService
1111
{
12-
static readonly Regex REGEX_FIND_USE_URL_REFERENCE = new Regex("<(use).*(xlink:href)=[\"|'](?<resource>[^\"|']+)", RegexOptions.Compiled);
12+
static readonly Regex REGEX_FIND_USE_URL_REFERENCE = new Regex("<(use).*(xlink:href)=[\"'](?<resource>[^\"#']+)", RegexOptions.Compiled);
1313

1414
public string EnsureDependencies(string referencingUrl, string content, IStaticWebService staticWebService, SiteConfigurationElement configuration, bool? useTemporaryAttribute, bool ignoreHtmlDependencies, Dictionary<string, string> currentPageResourcePairs = null, ConcurrentDictionary<string, string> replaceResourcePairs = null, int callDepth = 0)
1515
{

0 commit comments

Comments
 (0)