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 api key loading if RubyGems host is development #6683
Conversation
Co-authored-by: Eric Herscovich <eric.herscovich@shopify.com>
89bd322
to
38971b8
Compare
38971b8
to
33a02ee
Compare
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.
Looks good thank you!
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.
looks good to me, let's get a review from @hsbt or @deivid-rodriguez to double check 👍🏻
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 looks good to me!
Would anyone be able to merge this in? I don't have merge access for this repo 😄 |
done! |
Fix api key loading if RubyGems host is development (cherry picked from commit 73df193)
Fix api key loading if RubyGems host is development (cherry picked from commit 73df193)
What was the end-user or developer problem that led to this PR?
From: #6624 (comment)
The
gem signin
fails with a warning if the host islocalhost:3000
The original PR checks for invalid yaml like
invalid: foo: bar
by checking if there is:
in the key. It is possible to have:
as a part of the key likehttp://localhost:3000
.What is your fix for the problem, implemented in this PR?
Change the
includes?(":")
toincludes?(": ")
as that would prompt invalid yaml.Furthermore, after the warning was fixed, keys with
http://localhost:3000
still aren't successfully loaded. This is becauseWhen the api keys gets loaded, the localhost key has a trailing
/
causingGem.configuration.api_keys.key?(host)
to fail.The serialized key gets converted back here
__
, it gets replaced with.
and removes the trailing forward slash.In the case of
localhost:3000
, since there aren't any__
because the original host doesn't contain any.
, the forward slash never gets removed. I changed the elsif to remove any trailing forward slash.cc: @hsbt
Make sure the following tasks are checked