FreshRSS icon indicating copy to clipboard operation
FreshRSS copied to clipboard

[Bug] Docker Installation Fever API Favicons Error

Open wasabipesto opened this issue 1 year ago • 1 comments

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 avatar Jun 18 '24 23:06 wasabipesto

Regression due to https://github.com/FreshRSS/FreshRSS/pull/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): https://github.com/FreshRSS/FreshRSS/blob/7a9a24a0d0f2e5cc674995ce3174116803acde09/p/f.php#L52-L60

image

Alkarex avatar Jun 19 '24 07:06 Alkarex

@wasabipesto Would you be able to test https://github.com/FreshRSS/FreshRSS/pull/6624 ?

Edit: Merged in edge branch. Tests welcome

Alkarex avatar Jul 16 '24 19:07 Alkarex

Can confirm it works on edge. Thank you!

wasabipesto avatar Jul 17 '24 17:07 wasabipesto