neocities / neocities-ruby

The Neocities Gem - A CLI and library for using the Neocities web site API.
https://neocities.org
52 stars 12 forks source link

Strip api key whitespace to ease configuration #42

Closed sarayourfriend closed 1 year ago

sarayourfriend commented 1 year ago

Fixes #21 by trimming whitespace from the API key.

Testing instructions for Linux

To reproduce the bug:

  1. Confirm your existing API key works by trying neocities push and confirming it can check that files exist/push new files.
  2. Add \r to the end of ~/.config/neocities/config:
    $ cd ~/.config/neocities
    $ cp config config.bak
    # Trailing \r is added by vim and other editors automatically, so is a common configuration issue when juggling multiple site keys
    $ echo "$(cat config)\r" > config
  3. Now try neocities push again, and you should encounter the error from the linked issue.

To test that this PR works, keep the new config file with \r at the end, checkout this branch, and run ./bin/neocities push and confirm that the CLI now works with the trailing whitespace.

sarayourfriend commented 1 year ago

@kyledrake Any chance this PR could get a review?

sarayourfriend commented 1 year ago

@kyledrake Sorry for the multiple pings, just trying to get this off my list of open PRs. Let me know if this needs anything to get merged or if this project isn't accepting contributions and I'll either update the PR or close it.

kyledrake commented 1 year ago

Thanks!