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

Replace spaces in Asset subfolder names #3689

Closed
nixondesigndev opened this issue Jan 22, 2019 · 2 comments
Closed

Replace spaces in Asset subfolder names #3689

nixondesigndev opened this issue Jan 22, 2019 · 2 comments
Assignees
Labels
bug severity:normal Bugs that affect typical usage

Comments

@nixondesigndev
Copy link

Description

Currently it's possible for users to create a subfolder that contain spaces in the name. Craft then preserves these spaces in the file path. This is problematic when using the img srcset attribute and getUrl() as unlike the src attribute spaces are used as the delimiter for the descriptor. Spaces within the file url cause the browser to stop parsing and ignore srcset.

Craft should convert spaces in folder names to underscores (or similar) on folder creation, or disallow spaces entirely.

Additional info

  • Craft version: 3.1
  • PHP version: 7.1
@brandonkelly
Copy link
Member

I agree spaces shouldn’t ever be allowed, in filenames or subfolder names (unless a plugin were to modify the name after we’ve already removed the spaces ourselves).

@simpleim
Copy link

simpleim commented Mar 1, 2019

We just encountered this issue in 3.1.

I was pretty sure that this is a recent bug, and when testing on Craft 3.0.37, we found that subfolders with spaces are replaced with hyphens; e.g. "Banner Images" becomes "Banner-Images".

Since 3.1, this behaviour no longer occurs.

@brandonkelly brandonkelly added bug severity:normal Bugs that affect typical usage labels Mar 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug severity:normal Bugs that affect typical usage
Projects
None yet
Development

No branches or pull requests

4 participants