Skip to content

fix: use url-encoded ID in all paths (alternate method) #1820

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

Closed
wants to merge 1 commit into from

Conversation

JohnVillalovos
Copy link
Member

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 JohnVillalovos force-pushed the jlvillal/encoded_id_alt branch from 37dff7e to fd8a747 Compare January 9, 2022 07:20
@codecov-commenter
Copy link

codecov-commenter commented Jan 9, 2022

Codecov Report

Merging #1820 (99e1f8b) into main (ac81272) will increase coverage by 0.08%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##             main    #1820      +/-   ##
==========================================
+ Coverage   92.10%   92.18%   +0.08%     
==========================================
  Files          76       76              
  Lines        4801     4826      +25     
==========================================
+ Hits         4422     4449      +27     
+ Misses        379      377       -2     
Flag Coverage Δ
cli_func_v4 81.37% <26.35%> (+0.01%) ⬆️
py_func_v4 80.16% <58.91%> (-0.01%) ⬇️
unit 83.23% <34.10%> (+0.19%) ⬆️

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 72.22% <0.00%> (+3.80%) ⬆️
gitlab/v4/objects/geo_nodes.py 68.57% <0.00%> (ø)
gitlab/v4/objects/groups.py 87.78% <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.45% <63.15%> (-0.09%) ⬇️
gitlab/v4/objects/issues.py 89.02% <66.66%> (ø)
... and 10 more

@JohnVillalovos JohnVillalovos force-pushed the jlvillal/encoded_id_alt branch from fd8a747 to 1df929c Compare January 9, 2022 07:41
@JohnVillalovos JohnVillalovos marked this pull request as draft January 9, 2022 07:51
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 JohnVillalovos force-pushed the jlvillal/encoded_id_alt branch from 1df929c to 99e1f8b Compare January 9, 2022 08:53
@JohnVillalovos
Copy link
Member Author

The EncodedId class is kind of cool 😎 in my opinion... But also kind of complicated. It was really interesting figuring this out.

Interested to hear what you think @nejch

@JohnVillalovos JohnVillalovos requested a review from nejch January 9, 2022 08:55
@nejch nejch changed the title fix: use url-encoded ID in all paths ALTERNATE METHOD fix: use url-encoded ID in all paths (alternate method) Jan 9, 2022
@nejch
Copy link
Member

nejch commented Jan 13, 2022

I guess we can close this one @JohnVillalovos as the changes were essentially incorporated into the original one right?

@JohnVillalovos
Copy link
Member Author

I guess we can close this one @JohnVillalovos as the changes were essentially incorporated into the original one right?

Yep!

@nejch nejch deleted the jlvillal/encoded_id_alt branch May 9, 2022 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

project.wikis.create with subpages results in 404 Wiki Page Not Found
3 participants