Skip to content

Spaces swallowed on file upload in UI #1741

Open
@Bloke

Description

@Bloke

This isn't a bug, per se, but does lead to unexpected behaviour under certain circumstances.

STR:

  1. Prepare a file for upload with the filename:
    This is a test.txt (note: there are two spaces between 'a' and 'test').
  2. Upload via Content>Files.
  3. Note that the success message says that the file "This is a test.txt" (one space) has been uploaded successfully. And it's shown with one space in the file download list and on the file details panel. All good.
  4. Tapping to Download (hover over it) the file shows that the double space is preserved as a '++' in the file download link. Similarly, if you use the Textile/Tag/HTML tag builder, they contain the proper double spacing.
  5. If you are not aware of this and want to use the file in a shortcode (say) or a file_download tag to attach it to an article as a download, the user may go to the Files panel and simply copy the filename (with one space) as shown on-screen and plug it into the tag:
    <txp:file_download filename="This is a test.txt" />
  6. This leads to the file_download tag failing because it cannot find that file in the filesystem.

This is an ultra, ultra corner case and I don't think there's anything we can do about it. But if anyone has any clever ideas on the best approach (pass filename through a regex on upload to swallow multiple spaces and use that when we move_ulpoaded_file?) then it might be handy.

This has just happened on a live site and the admin there sent me a request asking why his download tag wasn't working!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions