volumio / Volumio2

Volumio 2 - Audiophile Music Player
http://volumio.org
Other
1.37k stars 316 forks source link

Missing file - fa-tags.svg #1868

Open xipmix opened 4 years ago

xipmix commented 4 years ago

This has been going on for quite a while (at least 2018, see #1690). Probably not urgent but simple to fix.

 volumio volumio[1329]: An internal error occurred while serving an albumart. Details: Error: ENOENT: no such file or directory, stat '/volumio/app/plugins/miscellanea/albumart/icons/fa-tags.svg'

There is a fa-tags.jpg but no .svg equivalent. The full list of files like this is

xipmix commented 4 years ago

Actually it could be viewed as a code problem. This https://github.com/volumio/Volumio2/blob/2488f384538546350daead0ec9c4ab706450c79a/app/plugins/miscellanea/albumart/albumart.js#L480 is the only instance where a .svg file is sent, the other sendFile() calls try a .jpg and then .png, e.g. https://github.com/volumio/Volumio2/blob/2488f384538546350daead0ec9c4ab706450c79a/app/plugins/miscellanea/albumart/albumart.js#L491-L495

which suggests this change

@@ -477,7 +477,15 @@ var processExpressRequest = function (req, res) {
         .fail(function () {
             res.setHeader('Cache-Control', 'public, max-age=' + maxage);
             if(icon!==undefined){
-                res.sendFile(__dirname + '/icons/'+icon+'.svg');
+                try {
+                    res.sendFile(__dirname + '/icons/'+icon+'.svg');
+                } catch(e) {
+                    try {
+                        res.sendFile(__dirname + '/icons/'+icon+'.jpg');
+                    } catch(e) {
+                        res.sendFile(__dirname + '/icons/'+icon+'.png');
+                    }
+                }

Of course the 'icon' case is a special case, is it true to say that all icons should be SVG format?