Repository navigation
fix(appearance): ICO favicons upload, SVG is no longer offered, names follow the content - #462
Conversation
… follow the content The favicon form said "PNG, ICO, SVG" and the logo form "PNG, JPG, SVG, WebP", but both used Laravel's image rule, which has neither ICO nor SVG. So an .ico favicon, the most common kind, was refused, and SVG never worked anywhere (Panelica#456). - favicon: 'file|mimes:png,ico', so .ico uploads work. - SVG stays out on purpose: the file is served from public/branding on the panel's own origin, where a script inside an SVG would run. It is removed from both hints (nine languages) and from the file pickers. - The stored name took the extension the browser sent. A PNG uploaded as logo.html passed the rule and was saved as logo_<time>.html, served as a page from the panel's origin. The extension now comes from the content (guessExtension), the same check the rule made. Fixes Panelica#456.
|
Merged, thank you. Verified the reasoning: Laravel's 3 of 4 tests red on 1.29.0 (the PNG case is the guard). Measured on the merge result: the full suite is green — 5463 passed in parallel ( |
|
Released in 1.30.0, the stable channel, offered to every installation. Gates on the tag and that package: full suite 5463 passed in parallel plus the 17 serial installer tests (0 failed, 5 skipped); 276 translation and parity tests green; the update lab 14 scenarios ALL GREEN; the real package updated the last stable (1.29.0 → 1.30.0, 13 checks) and the last beta (1.25.1-beta.1 → 1.30.0, 14 checks), each installed from its published package in the published runtime image with the signature checked by the key built into the application; the three uploaded assets re-downloaded and compared byte for byte before publishing. |
Fixes #456.
What was wrong
The favicon form says "PNG, ICO, SVG" and the logo form says "PNG, JPG, SVG, WebP". Both validate with Laravel's
imagerule, which accepts jpg, jpeg, png, gif, bmp and webp, and SVG only withimage:allow_svg. So:.icofavicon, the most common kind, was refused;The change
file|mimes:png,ico, so.icouploads work.public/branding, on the panel's own origin. A script inside an SVG would run there. Allowing it safely means sanitizing the SVG, which is a bigger change. SVG is removed from both hints (in the nine languages that have them) and from the file pickers'accept.logo.htmlpassed and was saved aslogo_<time>.html. The extension now comes from the content (guessExtension()), the same thing the rule checked.Tests
tests/Feature/BrandingUploadTest.phphas 4 tests. The ICO and file-name tests use a real temporary file rather thanUploadedFile::fake(), because the fake takes the file type from the name, not from the bytes. On main, 3 of the 4 fail: ICO, SVG/hints, and the file name. The PNG test passes on both. With the change, all 4 pass. Full suite: 5,430 passed; the 2 failures (CurrencyAndBackupTest, MailLinkHostTest) fail the same way on main.