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 relative path detection in stylesheet URLs #1130

Merged
merged 6 commits into from
Feb 15, 2023
Merged

Conversation

Equlnox
Copy link
Contributor

@Equlnox Equlnox commented Feb 14, 2023

There can URLs with protocols other than HTTP / HTTPs / FTP

Example:
If you have loom installed in your browser, it adds some stylesheets that refer to chrome-extension protocol

image

For such URLs, rrweb is pre-pending the webpage origin in the CSS.

This PR is meant to make the relative URL detection more generic.
The regex I have added has been taken from stack overflow - https://stackoverflow.com/a/19709846
It checks for the existence of a protocol in the URL.

@changeset-bot
Copy link

changeset-bot bot commented Feb 14, 2023

🦋 Changeset detected

Latest commit: 210a02e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
rrweb-snapshot Patch
rrweb Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Equlnox
Copy link
Contributor Author

Equlnox commented Feb 14, 2023

@Juice10 @YunFeng0817 thanks for fixing the syntax errors.
Does the change look good to you?

Copy link
Member

@YunFeng0817 YunFeng0817 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good. Thanks for the contribution.

@Equlnox
Copy link
Contributor Author

Equlnox commented Feb 15, 2023

@Yuyz0112 can this be merged please?

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

Successfully merging this pull request may close these issues.

3 participants