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

[5.x] Adds character replacements to ensure valid file names on Windows #10423

Merged
merged 4 commits into from
Jul 19, 2024

Conversation

pc-pdx
Copy link
Contributor

@pc-pdx pc-pdx commented Jul 9, 2024

Fixes #10421

It's possible for assets to be uploaded with, what Windows considers, invalid characters in pathname.
See Windows naming convention documentation for reference

This becomes a problem when hosting a live/dev site on a Linux system and the developer machine is Windows.
The client is uploading lots of files containing these characters and this prevents a Windows developer from pulling the latest content onto a local machine:

error: invalid path 'public/assets/.meta/example-filename:-more-words-here.docx.yaml'
error: invalid path 'public/assets/.meta/project-report:-stuff-and-things:-things-and-stuff.pdf.yaml'
error: invalid path 'public/assets/example-filename:-more-words-here.docx'
error: invalid path 'public/assets/project-report:-stuff-and-things:-things-and-stuff.pdf.yaml'

(* this is a redo of #10422 to address ' resubmit this PR from a personal GitHub account with maintainer permissions enabled')

@pc-pdx pc-pdx changed the title #10421 : Adds character replacements to ensure valid file names on W… [5.x] Adds character replacements to ensure valid file names on Windows Jul 9, 2024
Copy link
Member

@duncanmcclean duncanmcclean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request!

Works great - I've just added a test to confirm it does what it should. 👍

@jasonvarga jasonvarga merged commit f6b9a13 into statamic:5.x Jul 19, 2024
16 checks passed
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

Successfully merging this pull request may close these issues.

Asset Upload can result in file paths with invalid characters for Windows machines
3 participants