-
-
Notifications
You must be signed in to change notification settings - Fork 15
Allow files with space in filename #42
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
Conversation
Pierstoval
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made some suggestions for you. If you could remove the trim part, the gitignore, and replace your quotes concatenation with escapeshellarg() I'll merge it directly :)
.gitignore
Outdated
| ImageMagick*.tar.gz | ||
| /ImageMagick-*/ | ||
|
|
||
| .idea |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be versioned. Instead, you can use a global ignore file.
Example of command to create such file:
git config --global core.excludesfile ~/.gitignore
touch ~/.gitignore
echo ".idea" >> .gitignore
This will create a global ignore file that you can use to remove all unnecessary files from Git, like .DS_STORE (for macs), or thumbs.db for Windows, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for that tip :)
src/Command.php
Outdated
| $path = \rtrim($path, '/'); | ||
| } | ||
|
|
||
| $path = \trim($path, '"'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a flag argument to check whether to trim the value or not, reasons where inconsistent path checks. Adding trim() here makes the arg useless, while it is useful not to trim sometimes.
src/Command.php
Outdated
| } | ||
|
|
||
| $path = \trim($path, '"'); | ||
| $path = '"' . $path . '"'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For shell commands, PHP already has a function for that, called escapeshellarg()
|
Thanks @jonasschmidt95 👍 |
Wrap file path in quotes to allow files with spaces