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] Docker Installation Fever API Favicons Error #6573

Closed
wasabipesto opened this issue Jun 18, 2024 · 3 comments · Fixed by #6624
Closed

[Bug] Docker Installation Fever API Favicons Error #6573

wasabipesto opened this issue Jun 18, 2024 · 3 comments · Fixed by #6624
Labels
API 🤝 API for other clients Bug (confirmed) 🐞 issues that are reproducable Docker 🐋 Everything related to Docker Good first issue 1️⃣ Beginner friendly - New contributors are welcome help wanted Important 🔥
Milestone

Comments

@wasabipesto
Copy link

Describe the bug

Calling the fever API requesting favicons causes an error in 1.24.1. From the logs:

[Tue Jun 18 18:24:52.753539 2024] [php:error] [pid 2656] [client 172.19.0.1:34546] PHP Fatal error: Uncaught Error: Call to undefined function exif_imagetype() in /var/www/FreshRSS/p/api/fever.php:367\nStack trace:\n#0 /var/www/FreshRSS/p/api/fever.php(206): FeverAPI->getFavicons()\n#1 /var/www/FreshRSS/p/api/fever.php(575): FeverAPI->process()\n#2 {main}\n thrown in /var/www/FreshRSS/p/api/fever.php on line 367 172.19.0.1 - - [18/Jun/2024:18:24:52 -0400] "POST /api/fever.php?api&favicons HTTP/1.1" 500 - "-" "python-requests/2.28.2"

I am running this from the provided default docker image. My docker compose:

  freshrss:
    image: freshrss/freshrss:1.23.1
    container_name: freshrss
    hostname: freshrss
    restart: unless-stopped
    ports:
      - 8524:80
    volumes:
      - /opt/freshrss/data:/var/www/FreshRSS/data
      - /opt/freshrss/extensions:/var/www/FreshRSS/extensions
    environment:
      TZ: America/New_York
      CRON_MIN: 13,43

Rolling back to 1.23.1 fixes this.

To Reproduce

  1. Call /api/fever.php?api&favicons with proper API key
  2. Get a 500 error

Expected behavior

The output on docker image 1.23.1 returns the icons for each feed per the fever API spec, as expected.

FreshRSS version

1.23.1 is ok, 1.24.1 fails

Environment information

  • Database version: Docker-included default (SQLite)
  • PHP version: Docker-included default (8.2?)
  • Installation type: Docker (compose, above)
  • Web server type: Docker-included default (Apache)
  • Device: Any
  • OS: Any
  • Browser: N/A

Additional context

No response

@wasabipesto wasabipesto added the Bug (unconfirmed) issues thar could not reproduced yeat label Jun 18, 2024
@Alkarex Alkarex added this to the 1.25.0 milestone Jun 19, 2024
@Alkarex Alkarex added Docker 🐋 Everything related to Docker Bug (confirmed) 🐞 issues that are reproducable API 🤝 API for other clients and removed Bug (unconfirmed) issues thar could not reproduced yeat labels Jun 19, 2024
@Alkarex
Copy link
Member

Alkarex commented Jun 19, 2024

Regression due to #5994

It used to work in our Debian image, but not in our Alpine image:

$ docker run --rm freshrss/freshrss:1.23.1 php -r 'echo function_exists("exif_imagetype") ? "yes" : "no", "\n";'
yes

$ docker run --rm freshrss/freshrss:1.23.1-alpine php -r 'echo function_exists("exif_imagetype") ? "yes" : "no", "\n";'
no

$ docker run --rm freshrss/freshrss:edge php -r 'echo function_exists("image_type_to_mime_type") ? "yes" : "no", "\n";'
yes
$ docker run --rm freshrss/freshrss:edge php -r 'echo function_exists("getimagesize") ? "yes" : "no", "\n";'
yes
$ docker run --rm freshrss/freshrss:edge php -r 'echo function_exists("exif_imagetype") ? "yes" : "no", "\n";'
no

$ docker run --rm freshrss/freshrss:edge-alpine php -r 'echo function_exists("image_type_to_mime_type") ? "yes" : "no", "\n";'
yes
$ docker run --rm freshrss/freshrss:edge-alpine php -r 'echo function_exists("getimagesize") ? "yes" : "no", "\n";'
yes
$ docker run --rm freshrss/freshrss:edge-alpine php -r 'echo function_exists("exif_imagetype") ? "yes" : "no", "\n";'
no
$ docker run --rm freshrss/freshrss:edge-alpine php -r 'echo extension_loaded("gd") ? "yes" : "no", "\n";'
no

PR welcome.
To avoid depending on an additional exif extension, should be modified to use mime_content_type() instead as we already do elsewhere, or alternatively maybe getimagesize() (which seems to be available even when the gd library is not installed, strange):

FreshRSS/p/f.php

Lines 52 to 60 in 7a9a24a

$ico_content_type = 'image/x-icon';
if (function_exists('mime_content_type')) {
$ico_content_type = mime_content_type($ico);
}
switch ($ico_content_type) {
case 'image/svg':
$ico_content_type = 'image/svg+xml';
break;
}

image

@Alkarex Alkarex added Good first issue 1️⃣ Beginner friendly - New contributors are welcome help wanted Important 🔥 labels Jun 19, 2024
@Alkarex Alkarex modified the milestones: 1.25.0, 1.24.2 Jul 12, 2024
Alkarex added a commit to Alkarex/FreshRSS that referenced this issue Jul 16, 2024
@Alkarex
Copy link
Member

Alkarex commented Jul 16, 2024

@wasabipesto Would you be able to test #6624 ?

Edit: Merged in edge branch. Tests welcome

@wasabipesto
Copy link
Author

Can confirm it works on edge. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API 🤝 API for other clients Bug (confirmed) 🐞 issues that are reproducable Docker 🐋 Everything related to Docker Good first issue 1️⃣ Beginner friendly - New contributors are welcome help wanted Important 🔥
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants