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

fix: cleanup url before resolving resource path in css-loader #13005

Merged
merged 1 commit into from
Feb 15, 2022

Conversation

mcollovati
Copy link
Collaborator

@mcollovati mcollovati commented Feb 11, 2022

Description

URLs in CSS may contain a query string or fragment, that prevents a
correct resolution of resource real path and, consequently,
its inclusion in the output bundle. An example of this kind of url
are SVG Fragment Identifiers, such ones in fontawesome css:

url("../webfonts/fa-solid-900.svg#fontawesome")

When this URL is present on CSS file, the svg file will not be available
at runtime.
With this change, incoming URLs are cleaned up by removing potential
query string and fragment before resolving the real path against filesystem.

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

Additional for Feature type of change

  • Enhancement / new feature was discussed in a corresponding GitHub issue and Acceptance Criteria were created.

URLs in CSS may contain a query string or fragment, that prevents a
correct resolution of resource real path and, consequently,
its inclusion in the output bundle.  An example of this kind of url
are SVG Fragment Identifiers, such ones in fontawesome css:

`url("../webfonts/fa-solid-900.svg#fontawesome")`

When this URL is present on CSS file, the svg file will not be available
at runtime.
With this change, incoming URLs are cleaned up by removing potential
query string and fragment before resolving the real path against filesystem.
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@mcollovati mcollovati marked this pull request as ready for review February 11, 2022 20:07
@caalador caalador merged commit 31e985c into 2.8 Feb 15, 2022
@caalador caalador deleted the fix_css_loader_for_svg_fragments branch February 15, 2022 14:01
vaadin-bot pushed a commit that referenced this pull request Feb 15, 2022
URLs in CSS may contain a query string or fragment, that prevents a
correct resolution of resource real path and, consequently,
its inclusion in the output bundle.  An example of this kind of url
are SVG Fragment Identifiers, such ones in fontawesome css:

`url("../webfonts/fa-solid-900.svg#fontawesome")`

When this URL is present on CSS file, the svg file will not be available
at runtime.
With this change, incoming URLs are cleaned up by removing potential
query string and fragment before resolving the real path against filesystem.
vaadin-bot added a commit that referenced this pull request Feb 15, 2022
#13031)

URLs in CSS may contain a query string or fragment, that prevents a
correct resolution of resource real path and, consequently,
its inclusion in the output bundle.  An example of this kind of url
are SVG Fragment Identifiers, such ones in fontawesome css:

`url("../webfonts/fa-solid-900.svg#fontawesome")`

When this URL is present on CSS file, the svg file will not be available
at runtime.
With this change, incoming URLs are cleaned up by removing potential
query string and fragment before resolving the real path against filesystem.

Co-authored-by: Marco Collovati <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants