Issue with directories and trailing whitespaces

Created on 8 December 2016, over 7 years ago
Updated 24 April 2023, about 1 year ago

I have a project with... edge-case issues. We have webforms, upload-fields where one can configure the destination for the uploaded file/image.

Each webform has multiple such fields, where the images should go to the same directory. But since humans are at work with the destination-config... errors happen.

Now we have fields with "sites/default/files/foo" and others with "sites/default/files/foo ". That space at the end is the difference. It seems Unix accepts that, Windows doesn't care, and S3 also just creates the folder with that space at the end in the name.

The issue is with the Database. It considers both values to be the same, and throws a "duplicate key entry", and the caching of the S3-files aborts :/

I fixed that by removing the removal of trailing '/'... But I'm not sure if that doesn't break anything else.

If I'm not the only one with that issue I sure can create a patch. But an answer to "does that break anything?" would be nice :D for now it ... just looks fine and all works. But I'm not sure about going to prod with that.

πŸ› Bug report
Status

Needs work

Version

4.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany SerkanB

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States cmlara

    Moving to 4.x

    While it was noted in previous posts some commands do not call with a trailing '/' that actually would not be a blocker, we could query the database for 'like :placeholder OR like :placeholder/' to get directories, we would want to double check profiling for that for database impact if we were to do so.

    However doing so would actually leave the issue open for files that end in a space.

    It does appear that the path length count field as part of the primary key may still be the best method.

Production build 0.69.0 2024