server icon indicating copy to clipboard operation
server copied to clipboard

Theming app does not allow *.ico file types for favicon

Open terrytibbles opened this issue 7 years ago • 5 comments

Nextcloud version: 15.0.8

Results in a 'Unsupported image type' message. PNG works fine.

terrytibbles avatar Jun 14 '19 06:06 terrytibbles

Index: apps/theming/lib/Controller/ThemingController.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- apps/theming/lib/Controller/ThemingController.php	(revision 452d7696ff7e663f1794742d9708bb62a2771097)
+++ apps/theming/lib/Controller/ThemingController.php	(date 1560625529000)
@@ -326,7 +326,7 @@
 	 * @return array
 	 */
 	private function getSupportedUploadImageFormats(string $key): array {
-		$supportedFormats = ['image/jpeg', 'image/png', 'image/gif',];
+		$supportedFormats = ['image/jpeg', 'image/png', 'image/gif', 'image/x-icon'];
 
 		if ($key !== 'favicon' || $this->imageManager->shouldReplaceIcons() === true) {
 			$supportedFormats[] = 'image/svg+xml';

Does this work?

kesselb avatar Jun 15 '19 19:06 kesselb

Does this work?

It does work.

Currently, it makes it so all the image choices can be .ico files. Does it make sense to allow the login image, header logo, etc. to be set with .ico files? Do you think it would make sense to add this instead?

if ($key === 'favicon') {
    $supportedFormats[] = 'image/x-icon';
}

gary-kim avatar Jun 18 '19 10:06 gary-kim

Do you think it would make sense to add this instead?

Yes :+1: Mind to create a pr with these changes?

kesselb avatar Jun 18 '19 19:06 kesselb

Yes +1 Mind to create a pr with these changes?

Sure thing. Thank you.

gary-kim avatar Jun 18 '19 20:06 gary-kim

Does it make sense to allow the login image, header logo, etc. to be set with .ico files?

No, it doesn't. *.ico files are designed for the favicon only, not regular image files.

terrytibbles avatar Jun 19 '19 02:06 terrytibbles