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

Unable to check url inside <style> tag and css file #1485

Open
awang-01 opened this issue Aug 8, 2024 · 2 comments
Open

Unable to check url inside <style> tag and css file #1485

awang-01 opened this issue Aug 8, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@awang-01
Copy link

awang-01 commented Aug 8, 2024

There are two broken links on this page https://testing826.wpenginepowered.com/, if you inspect it, both image's url miss the "g" at the end of url

lychee -vv https://testing826.wpenginepowered.com/
✔ [200] https://testing826.wpenginepowered.com/assets/css/styles.css

🔍 1 Total (in 0s) ✅ 1 OK 🚫 0 Errors

it did not catch those two broken urls.

@mre
Copy link
Member

mre commented Aug 13, 2024

Here's a minimal example that we can use as a test:

<html>
   <head>
      <style>
         div {
             background-image: url("./lychee.png");
         }
      </style>
   </head>
</html>

The problem here (and in your example) is the relative path, ./lychee.png. (The extension doesn't matter at this point as it doesn't detect that link in the first place.)

We use linkify for parsing that, which doesn't discover a link here.
You can copy-paste it here to verify: https://robinst.github.io/linkify/

"file://lychee.png" would be detected and so would "http://example.com/lychee.png".

If we want to support these links in lychee, we'd have to do some smarter parsing.
We could use Servo's CSS parser, but it would require some work.

If someone is willing to look into that, I'd be open to accept pull requests, but I personally don't want to focus on it.

@mre mre changed the title Bug: unable to check url inside <style> tag and css file Unable to check url inside <style> tag and css file Aug 13, 2024
@mre mre added the enhancement New feature or request label Aug 13, 2024
@mre
Copy link
Member

mre commented Aug 13, 2024

This is more of a feature request than a bug, so I changed the issue title and added the enhancement label.

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

No branches or pull requests

2 participants