← Winnitude! Search  ·  Reader Mode (3312 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 215 LINKS

fix: use url-encoded ID in all paths by JohnVillalovos · Pull Request #1819 · python-gitlab/python-gitlab

Repository navigation

fix: use url-encoded ID in all paths - #1819


Merged
nejch merged 3 commits into main from jlvillal/encoded_id Jan 13, 2022
Merged

fix: use url-encoded ID in all paths #1819 nejch merged 3 commits into main from jlvillal/encoded_id

Conversation

JohnVillalovos commented Jan 9, 2022



Copy link Copy Markdown
Member

Make sure all usage of the ID in the URL path is encoded. Normally it
isn't an issue as most IDs are integers or strings which don't contain
a slash ('/'). But when the ID is a string with a slash character it
will break things.

Add a test case that shows this fixes wikis issue with subpages which
use the slash character.

Closes : #1079

JohnVillalovos marked this pull request as draft January 9, 2022 02:41 JohnVillalovos force-pushed the jlvillal/encoded_id branch from 720c11a to 598aa08
Compare
January 9, 2022 02:43 JohnVillalovos marked this pull request as ready for review January 9, 2022 02:47 JohnVillalovos requested a review from nejch January 9, 2022 02:47

codecov-commenter commented Jan 9, 2022 · edited Loading



Copy link Copy Markdown

Codecov Report

Merging #1819 (2d9612b ) into main (824151c ) will decrease coverage by 0.02%.
The diff coverage is 65.11%.

@@            Coverage Diff             @@
##             main    #1819      +/-   ##
==========================================
- Coverage   92.19%   92.17%   -0.03%     
==========================================
  Files          77       77              
  Lines        4819     4843      +24     
==========================================
+ Hits         4443     4464      +21     
- Misses        376      379       +3     
Flag Coverage Δ
cli_func_v4 81.33% <27.13%> (-0.02%) ⬇️
py_func_v4 80.19% <57.36%> (+0.03%) ⬆️
unit 83.19% <34.10%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
gitlab/v4/objects/epics.py 74.41% <0.00%> (ø)
gitlab/v4/objects/features.py 68.42% <0.00%> (ø)
gitlab/v4/objects/geo_nodes.py 68.57% <0.00%> (ø)
gitlab/v4/objects/merge_request_approvals.py 90.58% <0.00%> (ø)
gitlab/v4/objects/groups.py 87.96% <33.33%> (ø)
gitlab/v4/objects/jobs.py 77.27% <33.33%> (ø)
gitlab/v4/objects/projects.py 87.19% <33.33%> (ø)
gitlab/v4/objects/repositories.py 83.07% <55.55%> (ø)
gitlab/v4/objects/merge_requests.py 84.78% <62.50%> (ø)
gitlab/mixins.py 91.50% <65.00%> (-0.05%) ⬇️
... and 10 more
nejch requested changes Jan 9, 2022
View reviewed changes
JohnVillalovos added a commit that referenced this pull request Jan 9, 2022 fix: use url-encoded ID in all paths ALTERNATE METHOD 37dff7e
An alternative to #1819

Make sure all usage of the ID in the URL path is encoded. Normally it
isn't an issue as most IDs are integers or strings which don't contain
a slash ('/'). But when the ID is a string with a slash character it
will break things.

Add a test case that shows this fixes wikis issue with subpages which
use the slash character.

Closes: #1079
JohnVillalovos mentioned this pull request Jan 9, 2022 fix: use url-encoded ID in all paths (alternate method) #1820 Closed JohnVillalovos added a commit that referenced this pull request Jan 9, 2022 fix: use url-encoded ID in all paths ALTERNATE METHOD fd8a747
An alternative to #1819

Make sure all usage of the ID in the URL path is encoded. Normally it
isn't an issue as most IDs are integers or strings which don't contain
a slash ('/'). But when the ID is a string with a slash character it
will break things.

Add a test case that shows this fixes wikis issue with subpages which
use the slash character.

Closes: #1079
JohnVillalovos added a commit that referenced this pull request Jan 9, 2022 fix: use url-encoded ID in all paths ALTERNATE METHOD 1df929c
An alternative to #1819

Make sure all usage of the ID in the URL path is encoded. Normally it
isn't an issue as most IDs are integers or strings which don't contain
a slash ('/'). But when the ID is a string with a slash character it
will break things.

Add a test case that shows this fixes wikis issue with subpages which
use the slash character.

Closes: #1079
JohnVillalovos added a commit that referenced this pull request Jan 9, 2022 fix: use url-encoded ID in all paths ALTERNATE METHOD 99e1f8b
An alternative to #1819

Make sure all usage of the ID in the URL path is encoded. Normally it
isn't an issue as most IDs are integers or strings which don't contain
a slash ('/'). But when the ID is a string with a slash character it
will break things.

Add a test case that shows this fixes wikis issue with subpages which
use the slash character.

Closes: #1079
JohnVillalovos marked this pull request as draft January 9, 2022 08:55 JohnVillalovos force-pushed the jlvillal/encoded_id branch 2 times, most recently from 9b40dda to 54abe80
Compare
January 9, 2022 20:09 JohnVillalovos marked this pull request as ready for review January 9, 2022 20:09 JohnVillalovos requested a review from nejch January 9, 2022 20:09 nejch reviewed Jan 9, 2022
View reviewed changes
JohnVillalovos force-pushed the jlvillal/encoded_id branch from 54abe80 to e6ba4b2
Compare
January 9, 2022 20:35 nejch reviewed Jan 9, 2022
View reviewed changes
nejch reviewed Jan 9, 2022
View reviewed changes
JohnVillalovos force-pushed the jlvillal/encoded_id branch 3 times, most recently from 9896154 to f9fed09
Compare
January 10, 2022 02:55 JohnVillalovos requested a review from nejch January 10, 2022 05:41 JohnVillalovos force-pushed the jlvillal/encoded_id branch 3 times, most recently from c865920 to af3f5ae
Compare
January 10, 2022 06:31 nejch reviewed Jan 11, 2022
View reviewed changes

nejch left a comment



Copy link Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the update again! Just a few questions from me :)

JohnVillalovos force-pushed the jlvillal/encoded_id branch 2 times, most recently from a5ff3b5 to 826a03f
Compare
January 11, 2022 02:11 JohnVillalovos requested a review from nejch January 11, 2022 02:12 nejch reviewed Jan 13, 2022
View reviewed changes
JohnVillalovos requested a review from nejch January 13, 2022 17:33 nejch reviewed Jan 13, 2022
View reviewed changes
JohnVillalovos added 2 commits January 13, 2022 10:31 fix: use url-encoded ID in all paths 12435d7
Make sure all usage of the ID in the URL path is encoded. Normally it
isn't an issue as most IDs are integers or strings which don't contain
a slash ('/'). But when the ID is a string with a slash character it
will break things.

Add a test case that shows this fixes wikis issue with subpages which
use the slash character.

Closes: #1079
chore: add EncodedId string class to use to hold URL-encoded paths a2e7c38
Add EncodedId string class. This class returns a URL-encoded string
but ensures it will only URL-encode it once even if recursively
called.

Also added some functional tests of 'lazy' objects to make sure they
work.
JohnVillalovos force-pushed the jlvillal/encoded_id branch 2 times, most recently from a3983fc to 2d9612b
Compare
January 13, 2022 18:47 nejch reviewed Jan 13, 2022
View reviewed changes
JohnVillalovos force-pushed the jlvillal/encoded_id branch from 2d9612b to 10f9ca4
Compare
January 13, 2022 18:57 JohnVillalovos requested a review from nejch January 13, 2022 18:58 JohnVillalovos force-pushed the jlvillal/encoded_id branch 3 times, most recently from 16f725f to a05ee47
Compare
January 13, 2022 19:12 nejch reviewed Jan 13, 2022
View reviewed changes
JohnVillalovos force-pushed the jlvillal/encoded_id branch from a05ee47 to 25d9125
Compare
January 13, 2022 19:15 nejch reviewed Jan 13, 2022
View reviewed changes
JohnVillalovos requested a review from nejch January 13, 2022 19:16 chore: replace usage of utils._url_encode() with utils.EncodedId() b07eece
utils.EncodedId() has basically the same functionalityy of using
utils._url_encode(). So remove utils._url_encode() as we don't need
it.
JohnVillalovos force-pushed the jlvillal/encoded_id branch from 25d9125 to b07eece
Compare
January 13, 2022 19:17 nejch approved these changes Jan 13, 2022
View reviewed changes

nejch left a comment



Copy link Copy Markdown
Member

Choose a reason for hiding this comment

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

Awesome @JohnVillalovos this will fix like 90% of the CLI path issues for sub-resources :)

nejch merged commit bc48840 into main Jan 13, 2022 nejch deleted the jlvillal/encoded_id branch January 13, 2022 19:48

JohnVillalovos commented Jan 13, 2022



Copy link Copy Markdown
Member

Author

Thanks for all the reviews @nejch Looks a LOT better from where I started 😊

This was referenced Jan 13, 2022 test(functional): check mixin behavior with lazy objects #1824 Closed Object deletion from lazy get #1494 Closed fix: urlencode id part of path #1606 Closed JohnVillalovos mentioned this pull request Jan 13, 2022 fix: allow updating of sub-pages in wikis #1080 Closed Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment

Labels

None yet

3 participants