Command.RawArgs has surrounding whitespace trimmed #373
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello tulir and gomuks contributors,
This PR trims the extreme left and right whitespace around
. This should fail and throw a "file not found" error).
command.RawArgs
, which, among other things, is used as the path of the file in the/upload
command. I found the following behavior when using gomuks in macos: in the terminal, you're allowed to drag and drop a file from the desktop or "finder", and terminal pastes the absolute path, followed by a space. This caused gomuks on the latest master branch to throw afile not found
exception, while taking care to delete the extra space character succeeds of course (steps to reproduce: in any room, type/upload /correct/path/to/file
followed by a space,strings.TrimSpace
only trims space on the extreme left and right. Sincestrings.Fields
also trims this whitespace as well as whitespace between the words I think it is reasonable to trim whitespace forcommand.RawArgs
. As far as I can tell, this doesn't break any other commands thatRawArgs
is used for.Thank you, am looking forward to your input on this.