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

CssRewriteUrlTransformFixed strips out quotes in url #8

Closed
mrbelk opened this issue Jul 27, 2015 · 9 comments
Closed

CssRewriteUrlTransformFixed strips out quotes in url #8

mrbelk opened this issue Jul 27, 2015 · 9 comments
Milestone

Comments

@mrbelk
Copy link

mrbelk commented Jul 27, 2015

I had some issues with embedded graphics in a background image. Here is the CSS:

background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100%' height='1'><rect fill='#c8c7cc' x='0' y='0' width='100%' height='0.5'/></svg>");

As you know, the ASP.NET bundling system wants to make the "data" part a relative URL and the image breaks. I installed your Nuget and, while it corrects that behavior, it also seems to strip the containing quotes inside the "url" value and the image can't be rendered.

According to Chrome's inspector, the CSS looks like this:

background-image: url(data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100%' height='1'><rect fill='#c8c7cc' x='0' y='0' width='100%' height='0.5'/></svg>);

I think it must be something in your regex match/replace.

Thanks,
Matthew

@benmccallum
Copy link
Owner

Hi @mrbelk, If you disable minification, by setting in your web.config, do the surrounding quotes remain? Just wondering if it's the minifier which could be getting rid of quotes thinking they aren't required, because usually they aren't.

@mrbelk
Copy link
Author

mrbelk commented Jul 27, 2015

Well, it doesn’t do it when I am debugging; let me try setting that property on the BundleTable class in global.asax.cs on my “release” test site.

Thanks,
Matthew

@mrbelk
Copy link
Author

mrbelk commented Jul 27, 2015

well, that's awesome. When I set

BundleTable.EnableOptimizations = false;

in global.asax.cs, everything works right. clearly this is non-optimal, though.

@benmccallum
Copy link
Owner

It's okay, I just need to adjust the regex like you mentioned. Working on a fix now.

@mrbelk
Copy link
Author

mrbelk commented Jul 27, 2015

awesome. thanks. will you update the nuget package fairly quickly?

benmccallum added a commit that referenced this issue Jul 27, 2015
…ike data:, keep their surrounding quotations chars in case they are needed, e.g. non-base64 encoded svg.

#8
@benmccallum
Copy link
Owner

Give it a quick second but it's up now, v2.0.2:
https://www.nuget.org/packages/AspNetBundling/2.0.2

Cheers for logging the bug! Another reason to use my package as that regex was straight out of the original library.

@benmccallum benmccallum added this to the 2.0.2 milestone Jul 27, 2015
@mrbelk
Copy link
Author

mrbelk commented Jul 27, 2015

awesome. thanks for such a quick turnaround on this.

@benmccallum
Copy link
Owner

No worries. You caught me just before I went to bed. 12:15am here now in Aus haha. All the best.

@mrbelk
Copy link
Author

mrbelk commented Jul 27, 2015

perfect timing, then. nighty night.

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

2 participants