rdobson created on Sep 3, 2014:
https://combinator.codeplex.com/workitem/66
I have changed to the following:
private static void RegexAdjustRelativePaths(CombinatorResource resource, Uri cacheFileUri)
{
RegexProcessUrls(resource,
(match) =>
{
var url = match.Groups[1].ToString();
var uri = RegexMakeInlineUri(resource, url);
// Remote paths are preserved as full urls, local paths become uniformed relative ones.
var uriString = "";
if (resource.IsCdnResource || resource.AbsoluteUrl.Host != uri.Host || resource.AbsoluteUrl.Port != uri.Port)
uriString = uri.ToProtocolRelative();
else if (cacheFileUri != null && (cacheFileUri.Host != uri.Host || cacheFileUri.Port != uri.Port))
uriString = uri.ToProtocolRelative();
else
uriString = uri.PathAndQuery;
return "url(\"" + uriString + "\")";
});
}
I am passing in a uri of a fake file in storage to check against using the following method in CacheFileService:
public Uri GetUri() {
try {
var publicUrl = _storageProvider.GetPublicUrl("test.txt");
return new Uri(publicUrl);
}
// ReSharper disable once EmptyGeneralCatchClause
catch {
}
return null;
}