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

Favicon improvements #1152

Merged
merged 10 commits into from
May 2, 2020
Merged

Favicon improvements #1152

merged 10 commits into from
May 2, 2020

Conversation

jtojnar
Copy link
Member

@jtojnar jtojnar commented Oct 12, 2019

Replaces #1124

src/helpers/Image.php Outdated Show resolved Hide resolved
@jtojnar jtojnar force-pushed the favicon-improvements branch 2 times, most recently from 0c07cc0 to a7a9ff7 Compare October 15, 2019 13:13
@jtojnar jtojnar added this to the 2.19 milestone Oct 15, 2019
That is probably what the site intends, when it provides a feed logo.
@jtojnar jtojnar force-pushed the favicon-improvements branch 5 times, most recently from a4676ce to 0eac1e2 Compare May 1, 2020 22:45
jtojnar and others added 9 commits May 2, 2020 02:10
for feeds that do not have logo nor homepage for its favicon to get
There were actually two issues:

* The Guzzle options array contained `allow_redirects` key twice, losing the `redirects` option.
* The redirection stack was concatenated with +, causing the first URL in the stack to be overwritten by the initial URL.
And add a helper for obtaining effective URL.
Previously, we chose the icon from the HTML based on their type and when the link was broken we did not try another one. Additionally, we previously [1] accidentally stopped recognizing icons that used uppercase letters.

This commit fixes both by switching to a more robust regex-based parser and returning array of icons sorted by their size, that will be checked until we find a working one.

[1]: 6e0494c

Fixes #1122

Co-Authored-By: Jan Tojnar <[email protected]>
Previously, relative links to icons were resolved against the request URL, which need not be the final when redirects come into play. We obtain the effective URL we are redirected to and resolve links relative to that.

Co-Authored-By: Jan Tojnar <[email protected]>
Headers should be enough for most cases, you can set DEBUG to 2 to include bodies again.
HTML supports omitting quotes from attributes:

https://www.w3.org/TR/2012/WD-html-markup-20120329/syntax.html#attr-value-unquoted

We need to support that too.

It is used for example on xda-developers.com.
@jtojnar jtojnar force-pushed the favicon-improvements branch from 0eac1e2 to eb35239 Compare May 2, 2020 00:10
@jtojnar jtojnar merged commit eb35239 into master May 2, 2020
@jtojnar jtojnar deleted the favicon-improvements branch May 2, 2020 00:49
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.

2 participants