Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not possible to configure "any file extension" for File and Media field types. #647

Open
nitori opened this issue Nov 13, 2024 · 1 comment

Comments

@nitori
Copy link
Contributor

nitori commented Nov 13, 2024

When using a "File" or "Media" field type in Mask, it's currently not possible to specify the ability to attach any file type with any extension (the way it's configured in pages "media" field).

I suppose it's not as important for the "Media" type, but I'd like it for the "File" type.

image

When the allowedFileExtensions field is empty, Mask falls back to common-image-types or common-media-types.
If I insert an asterisk * in the field, then it appears to be correct at a glance when creating such a mask element, but when trying to actually add s file and save the element, the file just disappears.

Using * in the field sets the fields config/allowed TCA entry to "*".

The only working way seems to be to completely remove the "allowed" key from the TCA config, but there doesn't seem to be a way through Mask at the moment. Of course I can just remove it using TCA/Overrides.

I'd suggest (to keep some backwards compatibility), that the "allowed" key is only removed, if the special value * is inserted into the allowedFileExtensions field.

Greetings
Nitori

@nhovratov
Copy link
Collaborator

nhovratov commented Nov 16, 2024

Hm, this is a little bit more work. I would rather avoid having this magic with * removes allowed. The proper solution would be to not fall back to common-images-types. However, this is breaking so this needs a migrator which fills all the empty config with allowed: common-image-types.

I'm reaaally unsure if it is worth it. For most people the fallback is great. Allowing any file type is so uncommon. In such a case, as you said, one can use TCA/Overrides.

I'll keep this ticket open for others to see, in case they stumble over this issue. If you want to work on this case, you're of course welcome to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants