- Notifications
You must be signed in to change notification settings - Fork674
Support downloading archive subpaths#2199
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
JohnVillalovos commentedJul 28, 2022
@orf Thanks for the contribution! |
Uh oh!
There was an error while loading.Please reload this page.
JohnVillalovos left a comment
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 like conflict with the pre-existingpath variable.
nejch commentedJul 29, 2022
@JohnVillalovos for later: we could potentially also prefix these internal python-gitlab variables in the mixins and custom methods to always avoid clashes with GitLab API attributes. So this would be @orf sometimes our variables happen to overlap with upstream API attributes hence the suggestion. diff --git a/gitlab/v4/objects/repositories.py b/gitlab/v4/objects/repositories.pyindex 8f99e5d..b8dbdd8 100644--- a/gitlab/v4/objects/repositories.py+++ b/gitlab/v4/objects/repositories.py@@ -229,16 +229,16 @@ class RepositoryMixin(_RestObjectBase): Returns: The binary data of the archive """- path = f"/projects/{self.encoded_id}/repository/archive"+ url_path = f"/projects/{self.encoded_id}/repository/archive" if format:- path += "." + format+ url_path += "." + format query_data = {} if sha: query_data["sha"] = sha if path is not None: query_data["path"] = path result = self.manager.gitlab.http_get(- path, query_data=query_data, raw=True, streamed=streamed, **kwargs+ url_path, query_data=query_data, raw=True, streamed=streamed, **kwargs ) if TYPE_CHECKING: assert isinstance(result, requests.Response) |
orf commentedJul 29, 2022
Thank you both! I've applied your suggestions 🙏 |
nejch commentedJul 29, 2022
I guess we can get this one in, I hope you don't mind@JohnVillalovos ;) @orf thanks again! I think I recognized your username from the loguru saga, fun popcorn material. :) |
JohnVillalovos commentedJul 29, 2022
Thanks for reviewing it@nejch ! |
https://docs.gitlab.com/ee/api/repositories.html#get-file-archive
The archive endpoint supports a
pathargument. This change adds support for it.