-
Notifications
You must be signed in to change notification settings - Fork 668
project.wikis.create with subpages results in 404 Wiki Page Not Found #1079
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
Comments
@kernelport I think I can replicate your url encoding fix as well. this works: page = wiki.project.wikis.get('my/path/to/asdasd')
>>> page.save()
>>> page.slug
'my/path/to/asdasd'
>>> page.slug = 'my%2Fpath%2Fto%2Fasdasd'
>>> page.save()
>>> but this will 404 error: >>> page.slug = 'my%2Fpath%2Fto/asdasd'
>>> page.save()
Traceback (most recent call last):
File "/Library/Python/3.8/site-packages/gitlab/exceptions.py", line 304, in wrapped_f
return f(*args, **kwargs)
File "/Library/Python/3.8/site-packages/gitlab/mixins.py", line 417, in update
result = http_method(path, post_data=new_data, files=files, **kwargs)
File "/Library/Python/3.8/site-packages/gitlab/client.py", line 807, in http_put
result = self.http_request(
File "/Library/Python/3.8/site-packages/gitlab/client.py", line 628, in http_request
raise gitlab.exceptions.GitlabHttpError(
gitlab.exceptions.GitlabHttpError: 404: 404 Not Found
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/3.8/site-packages/gitlab/mixins.py", line 552, in save
server_data = self.manager.update(obj_id, updated_data, **kwargs)
File "/Library/Python/3.8/site-packages/gitlab/exceptions.py", line 306, in wrapped_f
raise error(e.error_message, e.response_code, e.response_body) from e
gitlab.exceptions.GitlabUpdateError: 404: 404 Not Found
>>> |
JohnVillalovos
pushed a commit
to kernelport/python-gitlab
that referenced
this issue
Jan 9, 2022
Make it possible to update subpages in wikis Update SaveMixin to use utils._url_encode() on the ID if it is a string. Closes: python-gitlab#1079
JohnVillalovos
pushed a commit
to kernelport/python-gitlab
that referenced
this issue
Jan 9, 2022
Make it possible to update subpages in wikis Update SaveMixin to use utils._url_encode() on the ID if it is a string. Closes: python-gitlab#1079
JohnVillalovos
added a commit
that referenced
this issue
Jan 9, 2022
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 issue
Jan 9, 2022
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 issue
Jan 9, 2022
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 issue
Jan 9, 2022
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 issue
Jan 9, 2022
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 issue
Jan 9, 2022
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 issue
Jan 9, 2022
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 issue
Jan 9, 2022
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 issue
Jan 9, 2022
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 issue
Jan 10, 2022
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 issue
Jan 10, 2022
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 issue
Jan 13, 2022
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Description of the problem, including code/CLI snippet
page = project.wikis.create({'title': "title/subtitle", 'content': "test content"})
does create a wiki subtitle in the directory title well.
If I try to edit this page with:
page.content = "update content"
page.title = "subtitle" # Attention: during update the page we have to set the title without the directory name
page.save()
I get gitlab.exceptions.GitlabUpdateError: 404: 404 Wiki Page Not Found
I can reproduce this by using curl:
curl --request PUT --data "content=update content" --header "PRIVATE-TOKEN: XXX" https://gitlab.kernelport.com/api/v4/projects/231/wikis/title/subtitle
But when I encode the slug URL it does work with curl.
curl --request PUT --data "content=update content" --header "PRIVATE-TOKEN: XXX" https://gitlab.kernelport.com/api/v4/projects/231/wikis/title%2Fsubtitle
How can I handle this URL Encoding for slug in python-gitlab correct?
Expected Behavior
Actual Behavior
Specifications
The text was updated successfully, but these errors were encountered: