Closed
Labels
Description
Description of the problem, including code/CLI snippet
when trying to
from gitlab import Gitlab
project=Gitlab(GITLAB_SRC).projects.get(GITLAB_PROJECT_ID)
project.files.get(file_path=PATH_TO_FILE, ref=GITLAB_REF)where PATH_TO_FILE is in the form of {directory}/{filename}, client returns not found error. (see github action: https://github.com/xgui3783/python-gitlab-exmaple/actions/runs/786113706)
I suspect this is due to double escaping the / character from:
GetMixin.get(https://github.com/python-gitlab/python-gitlab/blob/8933113/gitlab/mixins.py#L104) andProjectFileManager.get()python-gitlab/gitlab/v4/objects/files.py
Line 97 in 8933113
file_path = file_path.replace("/", "%2F")
Expected Behavior
return file descriptor
Actual Behavior
not found error
Specifications
- python-gitlab version: v2.7.0
- API version you are using (v3/v4): v4
- Gitlab server version (or gitlab.com): gitlab.com
Activity
hotfix: pin python-gitlab to v2.6.0
JohnVillalovos commentedon Apr 26, 2021
This might be related to commit b4dac5c done by @em-
JohnVillalovos commentedon Apr 26, 2021
I do notice that this will happen:
With this code:
nejch commentedon Apr 26, 2021
Yes, I think the
get()override for ProjectFileManager (or at least the extra replace) is unnecessary now that the ID is already url-encoded. @JohnVillalovos are you already working on this? Otherwise I'll be pushing a fix tonight.nejch commentedon Apr 26, 2021
Related: #1356
JohnVillalovos commentedon Apr 26, 2021
@nejch No. Sorry I am doing my day-job at the moment. So I can't work on it 😢
nejch commentedon Apr 26, 2021
All good! Just wanted to check, because I'm already looking at this, didn't want us both to work on it at the same time ;)
xgui3783 commentedon Apr 26, 2021
Thanks for the quick fix! 👏👏👏