statamic / cms

The core Laravel CMS Composer package
https://statamic.com
Other
4.07k stars 533 forks source link

"The given data was invalid" when uploading a GLB file [4.57.0] #10069

Closed espenlg closed 6 months ago

espenlg commented 6 months ago

Bug description

I'm having problems uploading GLB-files to the assets container. I've tried to disable the automatic image processing just in case, and I've tried both on my local dev-environment and on the production-environment, but still the same. Uploading other non-image files as PDF or MP4 is not a problem. File size is not the issue, it is well within the configured limits.

This is a screenshot from CP; Screenshot 2024-05-14 at 12 50 05

..and this is what the POST request returns: Screenshot 2024-05-14 at 12 50 44

How to reproduce

In short - try to upload a file with extension .glb to the assets container. It doesn't have to be an actual .glb 3d-model file, I tried to rename a jpg to glb just to check and I get the same error.

Logs

No response

Environment

Environment
Application Name: Statamic
Laravel Version: 10.48.7
PHP Version: 8.2.16
Composer Version: 2.7.2
Environment: local
Debug Mode: ENABLED
URL: cody.test
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Statamic
Addons: 0
Antlers: runtime
Sites: 2 (Norsk, English)
Stache Watcher: Enabled
Static Caching: Disabled
Version: 4.57.0 PRO

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

duncanmcclean commented 6 months ago

In #9037, we introduced some validation to prevent files with unwanted file extensions being uploaded without being specifically whitelisted.

The .glb file extension is not part of the file extensions whitelist in Statamic. However, you can add additional file extensions as needed, in your config/statamic/assets.php config file:

/*
|--------------------------------------------------------------------------
| Additional Uploadable Extensions
|--------------------------------------------------------------------------
|
| Statamic will only allow uploads of certain approved file extensions.
| If you need to allow more file extensions, you may add them here.
|
*/

'additional_uploadable_extensions' => [
    'glb',
],
espenlg commented 6 months ago

Thank you for clearing that up @duncanmcclean 👏