Synchro
Synchro

Reputation: 37770

How to prevent CKFinder renaming files with multiple extensions?

When I upload files with multiple extensions using CKFinder (with PHP), it renames them, replacing the dots with underscores for all but the last one. For example it will rename file.1.1.jpg to file_1_1.jpg. Setting the CheckDoubleExtension config property to false prevents the rename but I don't see why it's being applied because 1 is not a disallowed char and does not appear in my deniedExtensions list for the resource type I'm uploading. Also I don't really want to disable it because I'd like the protection it adds - but it's not much use if it's broken. However I can't find any other config items that are related to this.

How can I prevent CKFinder renaming these files without losing this protection?

Upvotes: 1

Views: 581

Answers (1)

Wiktor Walc
Wiktor Walc

Reputation: 5560

If allowedExtensions is defined then it has higher priority than deniedExtensions. If 1 is not on the list of allowed extensions, it has the same meaning for CKFinder as exe or php.

How can I prevent CKFinder renaming these files without losing this protection?

Right now in CKFinder 2.x the only way to achieve what you need is to extend the list of allowed extensions.

If you fill a feature request and there will be a significant demand for such feature, we may provide some way to define a callback in which you could sanitize the file name using your own rules.

Upvotes: 0

Related Questions