-
Notifications
You must be signed in to change notification settings - Fork 8
Fix #493: Ignore leading/trailing spaces in url #494
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
Fix #493: Ignore leading/trailing spaces in url #494
Conversation
Thanks for your contribution. There seems to be an issue with these changes. According to unit tests, this URL isn't parsed correctly: |
I think it would be much better to use |
Thank you for you suggestion. Could you explain why the url should be valid? I guess it means the http is not required, is it? And it failed because the first part is empty. Also, could you give instructions how to run unit tests locally? |
Yes, You can also add a test for this issue if you want. It's in the |
It is so nice working with you :) I have also configured github action on my forked repo, and my 3rd commit has passed the unit test over there |
Actually, unit tests are supposed to run in the pull request. There's no need to create a GitHub action in the forked repository. The problem is that I have to approve the checks manually before they run in the pull request. Maybe I should disable that... By the way, do you also want to add a test for these changes or should I do it after merging the PR? |
Was in a bit hurry earlier today. Added tests with trailing and/or leading spaces. Looks fine so far. |
Just a small detail. The newline at line 64 in projecturl.cpp shouldn't be there and was probably added by accident. Besides that everything looks good. |
ok you win
Error: There's no line 68 in that file. Do you mean: 64? |
Yes, I meant 64, that was probably a typo. |
src/internal/projecturl.cpp
Outdated
@@ -17,6 +17,19 @@ ProjectUrl::ProjectUrl(const std::string &url) | |||
std::istringstream stream(url); | |||
std::string str; | |||
|
|||
// Whitespaces to be removed | |||
const char* whitespace = " \t\v\r\n"; |
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.
It would be better if this constant were static
so that it isn't recreated whenever ProjectUrl is constructed.
src/internal/projecturl.cpp
Outdated
@@ -47,3 +65,4 @@ const std::string &ProjectUrl::projectId() const | |||
{ | |||
return m_projectId; | |||
} | |||
|
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 newline was probably added by accident.
Resolves #493.