server icon indicating copy to clipboard operation
server copied to clipboard

[Bug]: occ theming:config favicon "/root/nc.ico" Unsupported image type for .ico and .png

Open ne0YT opened this issue 1 year ago • 11 comments

⚠️ This issue respects the following points: ⚠️

Bug description

setting favicon doesnt work: occ theming:config favicon "/root/nc.ico"

it tells me:

In ImageManager.php line 233:

  Unsupported image type

theming:config [-r|--reset] [--] [<key> [<value>]]

also happens with .png and .svg..

Steps to reproduce

  1. having an ico-file named nc.ico inside /root
  2. running this: occ theming:config favicon "/root/nc.ico"

Expected behavior

it sets my icon as the favicon

Installation method

Community SNAP package

Nextcloud Server version

25

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database engine version

MySQL

Is this bug present after an update or on a fresh install?

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • [ ] Default user-backend (database)
  • [X] LDAP/ Active Directory
  • [X] SSO - SAML
  • [ ] Other

Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

ne0YT avatar Jun 15 '23 15:06 ne0YT

You can use an ICO file if the mime type is image/x-icon or image/vnd.microsoft.icon. Your file has a different mime type and therefor the exception.

kesselb avatar Jun 15 '23 17:06 kesselb

You can use an ICO file if the mime type is image/x-icon or image/vnd.microsoft.icon. Your file has a different mime type and therefor the exception. the error occurs because I download the file from another nextcloud using wget. and even if I convert the ico back and forth (png - ico) using the convert command it wil still give me the same error.

also it works using the webinterface jsut not using .occ It would make it much easier for me to generally allow .ico files as it works in many other places.

ne0YT avatar Jun 16 '23 12:06 ne0YT

I now even downloaded the current favicon on my nextcloud setup and used it using the occ commadn and it gives me the same error..

ne0YT avatar Jun 16 '23 12:06 ne0YT

file --mime-type logo.ico to print the mime type of the file.

kesselb avatar Jun 16 '23 14:06 kesselb

nc.ico: image/vnd.microsoft.icon

and it does not work. "Unsupported image type"

ne0YT avatar Jun 16 '23 14:06 ne0YT

The mime type looks correct. I just had a test with a random ico file. It works over here.

php -r "var_dump(mime_content_type('/path/to/your/file.ico'));"

You can run the snippet above. That's the same function we use internally to detect the mime type.

kesselb avatar Jun 16 '23 14:06 kesselb

'));"

string(24) "image/vnd.microsoft.icon"

ne0YT avatar Jun 16 '23 14:06 ne0YT

The mime type looks correct. I just had a test with a random ico file. It works over here.

php -r "var_dump(mime_content_type('/path/to/your/file.ico'));"

You can run the snippet above. That's the same function we use internally to detect the mime type.

maybe I need to move the file somehwere as I installed nextcloud as a snap-package?

ne0YT avatar Jun 16 '23 14:06 ne0YT

I assume nextcloud.occ theming:config won't work as you execute the command on the host, but the file is expected inside the container. But it should also lead to a different error message because the file does not exist :shrug:

kesselb avatar Jun 16 '23 15:06 kesselb

Possibly the snaps confinement blocks the file_exists check from working correctly? Cc @kyrofa

szaimen avatar Jun 16 '23 16:06 szaimen

Possibly the snaps confinement blocks the file_exists check from working correctly?

The favicon is in /root/nc.ico? Assuming this is an Ubuntu-based distro and it's properly confined, yeah almost certainly. Try putting it in /var/snap/nextcloud/common/ somewhere.

kyrofa avatar Jun 16 '23 16:06 kyrofa

works, not a bug

ne0YT avatar Jun 19 '23 08:06 ne0YT