Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert relative URLs to absolute ones pointing to the site domain when processing font URLs #5

Open
I3undy opened this issue Dec 1, 2015 · 0 comments

Comments

@I3undy
Copy link
Member

I3undy commented Dec 1, 2015

@Piedone created on Jul 30, 2014:
https://orchardwatcher.codeplex.com/workitem/2

Premises: processed resources should be stored in a remote storage AND using a resource base URL.

There's an issue when there are local source URLs for fonts, e.g.:

@font-face {
  font-family: 'FontAwesome';
  src: url('../Content/fonts/fontawesome-webfont.eot?v=4.0.3');
  src: url('../Content/fonts/fontawesome-webfont.eot?#iefix&v=4.0.3') format('embedded-opentype'), url('../Content/fonts/fontawesome-webfont.woff?v=4.0.3') format('woff'), url('../Content/fonts/fontawesome-webfont.ttf?v=4.0.3') format('truetype'), url('../Content/fonts/fontawesome-webfont.svg?v=4.0.3#fontawesomeregular') format('svg');
  font-weight: normal;
  font-style: normal;
}

These URLs, when the processed resource is saved to the remote storage, will be converted to unified relative, then protocoll-less absolute paths (see ResourceProcessingService.ConvertRelativeUrlsToAbsolute()). This causes a cross-origin error though: such fonts should rather be fetched from the site directly (i.e. their URL re-written as absolute ones, but pointing to the calling site).

The check needed for this could be made whether the current property is under font-face, but this can only be made from ExCSS, when that will be used in Combinator.

Alternatively you could enable CORS on the remote storage. This is a way to do it on Azure Blob storage: http://blog.codingoutloud.com/2014/02/21/stupid-azure-trick-6-a-cors-toggler-command-line-tool-for-windows-azure-blobs/ (on DotNest we'd indeed need to allow * because of the arbitrary site URLs, what is bad...).

The current workaround is to exclude the whole stylesheet containing the font face.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant