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

Command.RawArgs has surrounding whitespace trimmed #373

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FiskFan1999
Copy link

Hello tulir and gomuks contributors,

This PR trims the extreme left and right whitespace around 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 a file 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, . This should fail and throw a "file not found" error).

strings.TrimSpace only trims space on the extreme left and right. Since strings.Fields also trims this whitespace as well as whitespace between the words I think it is reasonable to trim whitespace for command.RawArgs. As far as I can tell, this doesn't break any other commands that RawArgs is used for.

Thank you, am looking forward to your input on this.

Copy link
Owner

@tulir tulir left a comment

Choose a reason for hiding this comment

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

Looks fairly sensible

@pataquets
Copy link

@tulir: Anything else needed to merge this in?

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.

3 participants