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

[Bug] Base href is not being applied correctly to all links; initial letter of relative links truncated #2829

Closed
tmb-github opened this issue Aug 19, 2019 · 5 comments · Fixed by #2831

Comments

@tmb-github
Copy link

commented Aug 19, 2019

OS: Windows 8.1
Webhint online scanner

The online scanner is not reading the base element href for some of the relative links in the head.

At https://thomasbrodhead.com, the base element is:

<base href="https://thomasbrodhead.com/">

. . . and the favicon is:

<link rel=icon href="favicons/favicon.20190811163149.ico" type="image/x-icon">

But scanning https://thomasbrodhead.com, the online scanner concludes that the favicon is found at:

https://thomasbrodhead.com/avicons/favicon.20190811163149.ico

Notice that the scanner has dropped the "f" in "/favicons/", resulting in a 404, as the resource as stated does not exist.

This can be found in the link reported in the "no-http-redirects" hint that is triggered by the scanner's inability to find the resource.

When scanning a subdirectory of the site, it becomes apparent that the base href is not being read and applied correctly.

At https://thomasbrodhead.com/chromatic-geometry, the base href is still set with:

<base href="https://thomasbrodhead.com/">

. . . and the favicon is indicated with:

<link rel=icon href="favicons/favicon.20190811163149.ico" type="image/x-icon">

But the scanner uses the URL, not the base href, for determining the location of the favicon, and concludes that it is:

https://thomasbrodhead.com/chromatic-geometry/avicons/favicon.20190811163149.ico

When it rightly is located at

https://thomasbrodhead.com/favicons/favicon.20190811163149.ico

Notice the double-problem here: the scanner has used the URL (https://thomasbrodhead.com/chromatic-geometry/) as the base of the link, not the href supplied in the html (https://thomasbrodhead.com/"). But then it then appends "avicons/favicon.20190811163149.ico" to the URL href, not "favicons/..." with an initial "f"...i.e., it truncates the initial letter of the resource.

In my scanning, this was revealed in the "http-cache" hints section. This problem results in 404 errors that trigger other hints (when the resource can't be found and interrogated by the scanner, the 404 page of the site is returned, and webhint then reports errors on those responses, etc.)

Many thanks,
Tom

🐛 Bug report

Description

Environment

  • hint version:
  • Node.js version:
  • OS:
  • URL for which webhint failed:

webhint configuration

webhint’s configuration
<!-- Paste the content of your `.hintrc` here -->

Debug output

Please include the raw output generated by webhint, or if possible,
the raw output from running webhint in debug mode: hint --debug <URL>.

webhint’s raw output
<!-- ✍️ Paste the raw output here -->


@tmb-github tmb-github added the type:bug label Aug 19, 2019

@sarvaje

This comment has been minimized.

Copy link
Member

commented Aug 19, 2019

@tmb-github Thanks for reporting this issue. I'm going to take a look to see what is happening.

@sarvaje sarvaje self-assigned this Aug 19, 2019

@antross antross added this to the 1908-2 milestone Aug 19, 2019

sarvaje added a commit to sarvaje/hint that referenced this issue Aug 19, 2019
@sarvaje

This comment has been minimized.

Copy link
Member

commented Aug 19, 2019

There was a problem generating the favicon, we were ignoring the url in the base element in this case.

I will try to deploy a new version of the online scanner as soon as the fix is published.

Thanks for opening the issue!

@bmt-systems

This comment has been minimized.

Copy link

commented Aug 26, 2019

The online scanner is still affected by the bug.

@sarvaje

This comment has been minimized.

Copy link
Member

commented Aug 26, 2019

@bmt-systems Yes, the scanner will be updated once the fix is published.

@antross do you know when are we publishing this fix?

@antross

This comment has been minimized.

Copy link
Member

commented Aug 26, 2019

I'll be working on it today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.