cli auth add
: do not fail with extraneous characters
#3521
Merged
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.
Description
The Solution:
I have hardened
auth add
by stripping out everything from the third '/' to the end of the instance URL.The Problem:
When adding an authorization for the peertube-cli, before this commit you could not have anything after the domain_name:port.
For instance, if there was a trailing / in your instance URL, before this commit it will always fail with
It took me over 20 minutes to figure out that this was the problem.
Related issues
peertube auth add
#3520: Accept trailing slash withpeertube auth add
Has this been tested?
Please describe the tests that you ran to verify your changes.
I attempted to run the entire test suite, but after many failed starts and one really long one, I cancelled the run after it had been going 37+ minutes. I then attempted to run the CLI tests alone, but that, too, I cancelled after 27 minutes. I then commented out everything inside
server/tests/cli/index.ts
except thepeertube.ts
. I then attempted to run it via the command found in theCONTRIBUTING.md
:but all I ended up with was:
So yeah, I was unable to run the tests, but I did create tests for my own feature.
This is the first time I've ever attempted to run Mocha tests before, and I found it very confusing. I am used to the downright simplicity of
phpunit tests/MyTest.php
or evenphpunit --filter beginningOfMyTestCaseName
. I stumbled around worse than a drunken pirate fresh off a won parlay.