-
Notifications
You must be signed in to change notification settings - Fork 179
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 some of the favicon errors #1319
Conversation
ini_set('user_agent', 'NextCloud-News/1.0'); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could also just use Guzzle to download the file, but I'm fine trying this first.
This comment has been minimized.
This comment has been minimized.
c53eb60
to
5c7adb1
Compare
So this reduced the amount of failing feeds for me but still have some errors left.
if copy fails with http erros it seems like
|
copy should return false in case of an error, so the mime check should probably only happen if copy succeeded. Check could be done e.g. like this: $downloaded = copy($favicon, $favicon_path);
$is_image = $downloaded && substr(mime_content_type($favicon_path), 0, 5) === "image"; |
ec99bc4
to
385379d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, I haven't tested it though.
But wouldn't it make sense to also add a changelog entry, since it's a reported bug, so that it's seen right away in the release?
// check if feed has a logo | ||
if (is_null($favicon)) { | ||
return $this->faviconFactory->get($url); | ||
} | ||
|
||
$favicon_path = join("/", [$this->ITempManager->getTempBaseDir(), basename($favicon)]); | ||
copy( | ||
|
||
$downloaded = copy( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still get errors copy(): Filename cannot be empty at /var/www/nextcloud/apps/news/lib/Fetcher/FeedFetcher.php#340
; perhaps that should be addressed as well here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the new change fixes that
True, it has to be also updated in the master branch though. |
385379d
to
c69eafa
Compare
Turns out that the favicon lib does indeed trim the urls, but the issue is it also tries to use the orignal url but as most feed endpoints won't be able to handle any favicon path, it causes errors in the log. While the favicon will be then fetched from the base url afterwards. |
@SMillerDev @anoymouserver Should we leave it like that for now, or put a try/catch around the getFavicon() |
But this causes plenty of errors: |
Is it possible that you did a mistake when applying this patch? |
Ja right, now I see that I forgot to update the dependency. |
change user agent for fetching the feeds log to 'NextCloud-News/1.0' check if logo in feed is just an empty string remove path of url before searching for a favicon check if file was actually downloaded Ignore http errors when fetching favicons Add feed to integration tests that doesn't have a logo Co-authored-by: Alec Kojaev <alec.kojaev@gmail.com> Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
6925e40
to
c9ea7c4
Compare
Squashed the commits |
/backport to master |
The backport to master failed. Please do this backport manually. |
Merged as it improves the situation even if it doesn't fix all issues yet. |
Yeah there's still to fix something: |
Yea we probably need to put a try catch around it but at that level there is no logger available and probably shouldn't |
@Grotax after upgrading to 15.4.1 I get a long list of output when the cronjob runs: |
Yea we already noticed, https://github.com/nextcloud/news/releases/tag/15.4.2 |
OK thanks |
Some potential improvements for favcion fetching.