feat(api): support file format for repository archive by dAnjou · Pull Request #1561 · python-gitlab/python-gitlab
Repository navigation
feat(api): support file format for repository archive - #1561
Merged
JohnVillalovos merged 1 commit into python-gitlab:main from dAnjou:patch-1 Dec 21, 2021
Merged
feat(api): support file format for repository archive #1561 JohnVillalovos merged 1 commit into python-gitlab:main from dAnjou:patch-1
Conversation
dAnjou commented Jul 31, 2021
Copy link Copy Markdown
Contributor
No description provided.
codecov-commenter commented Jul 31, 2021 · edited Loading
Copy link Copy Markdown
Codecov Report
@@ Coverage Diff @@ ## master #1561 +/- ## ========================================== - Coverage 91.16% 86.67% -4.50% ========================================== Files 74 74 Lines 4177 4179 +2 ========================================== - Hits 3808 3622 -186 - Misses 369 557 +188
Flags with carried forward coverage won't be shown. Click here to find out more.
|
View reviewed changes
JohnVillalovos 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 .
This will also need a documentation update in https://python-gitlab.readthedocs.io/en/stable/gl_objects/projects.html
See "Get the repository archive:"
And can it specify the possible options from https://docs.gitlab.com/ee/api/repositories.html#get-file-archive :
tar.gz, tar.bz2, tbz, tbz2, tb2, bz2, tar, and zip.
dAnjou commented Aug 1, 2021
Copy link Copy Markdown
Contributor
Author
|
Thanks, @JohnVillalovos ! Kinda submitted this as a conversation starter because I also wasn't quite sure about whether and where to add tests. Will make the changes you suggested. |
ba4e0da to
3c38eb6
Compare
August 1, 2021 10:44
dAnjou commented Aug 1, 2021
Copy link Copy Markdown
Contributor
Author
I was hesitant to explicitly list them in the method documentation because GitLab might change them, so instead I added a note with a link to the example. |
nejch commented Aug 1, 2021
Copy link Copy Markdown
Member
That's a good point, maybe this is easier long-term WDYT @JohnVillalovos ? If you want to add tests - maybe extract these lines into python-gitlab/tests/functional/api/test_repository.py Lines 51 to 55 in 90ecf2f
And maybe test that it really worked with e.g. |
JohnVillalovos commented Aug 1, 2021 · edited Loading
Copy link Copy Markdown
Member
Sounds reasonable to me. Could also add in the
I am perfectly fine with the current doc update with only the pointer to the Gitlab docs. |
ac51f09 to
3910048
Compare
August 6, 2021 13:55
dAnjou commented Aug 6, 2021
Copy link Copy Markdown
Contributor
Author
|
I've added a test and ran it locally a few times. For some reason it always got a 404 for |
nejch commented Aug 22, 2021
Copy link Copy Markdown
Member
@dAnjou Thanks, maybe it's something to do with URL encoding since they include |
JohnVillalovos commented Dec 17, 2021
Copy link Copy Markdown
Member
|
Thanks @dAnjou Can you rebase the patch rather than adding a merge commit? |
05557f2 to
dafcef1
Compare
December 17, 2021 20:40
JohnVillalovos commented Dec 18, 2021
Copy link Copy Markdown
Member
Strange. I wonder why that is happening. @nejch did you ever have a chance to investigate? |
JohnVillalovos commented Dec 18, 2021 · edited Loading
Copy link Copy Markdown
Member
I think I figured it out. See #1758 for my "fix" and can see the functional tests pass. @nejch would like to get your feedback on this. I really don't think that we should be converting periods to |
nejch commented Dec 19, 2021
Copy link Copy Markdown
Member
|
Ok, so it is encoding drama again 😅
Could be, would love to get rid of more custom code. Do you have a link to the other issue? We just need to make sure that this is not needed anymore: python-gitlab/gitlab/client.py Lines 596 to 601 in 3ee061c
So maybe need to check again what a221d7b was trying to achieve. And possibly test this with paths that may include dots so we don't have a regression 🤔 |
chore: stop encoding '.' to '%2E'
f6066c7
Forcing the encoding of '.' to '%2E' causes issues. It also goes against the RFC: https://datatracker.ietf.org/doc/html/rfc3986.html#section-2.3 From the RFC: For consistency, percent-encoded octets in the ranges of ALPHA (%41-%5A and %61-%7A), DIGIT (%30-%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should not be created by URI producers... Related #1006 Related #1356 Related #1561 BREAKING CHANGE: This possibly could be a breaking for users who have incorrectly configured GitLab servers which don't handle period '.' characters correctly.JohnVillalovos mentioned this pull request Dec 19, 2021 fix: stop encoding '.' to '%2E' #1766 Merged JohnVillalovos added a commit that referenced this pull request Dec 19, 2021
chore: stop encoding '.' to '%2E'
ca0e183
Forcing the encoding of '.' to '%2E' causes issues. It also goes against the RFC: https://datatracker.ietf.org/doc/html/rfc3986.html#section-2.3 From the RFC: For consistency, percent-encoded octets in the ranges of ALPHA (%41-%5A and %61-%7A), DIGIT (%30-%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should not be created by URI producers... Closes #1006 Related #1356 Related #1561 BREAKING CHANGE: This possibly could be a breaking for users who have incorrectly configured GitLab servers which don't handle period '.' characters correctly.JohnVillalovos added a commit that referenced this pull request Dec 20, 2021
chore: stop encoding '.' to '%2E'
d7893c1
Forcing the encoding of '.' to '%2E' causes issues. It also goes against the RFC: https://datatracker.ietf.org/doc/html/rfc3986.html#section-2.3 From the RFC: For consistency, percent-encoded octets in the ranges of ALPHA (%41-%5A and %61-%7A), DIGIT (%30-%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should not be created by URI producers... Closes #1006 Related #1356 Related #1561 BREAKING CHANGE: This could potentially be a breaking change for users who have incorrectly configured GitLab servers which don't handle period '.' characters correctly.JohnVillalovos added a commit that referenced this pull request Dec 20, 2021
chore: stop encoding '.' to '%2E'
39155df
Forcing the encoding of '.' to '%2E' causes issues. It also goes against the RFC: https://datatracker.ietf.org/doc/html/rfc3986.html#section-2.3 From the RFC: For consistency, percent-encoded octets in the ranges of ALPHA (%41-%5A and %61-%7A), DIGIT (%30-%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should not be created by URI producers... Closes #1006 Related #1356 Related #1561 BREAKING CHANGE: This could potentially be a breaking change for users who have incorrectly configured GitLab servers which don't handle period '.' characters correctly.
JohnVillalovos commented Dec 20, 2021
Copy link Copy Markdown
Member
I created a PR #1766 to get rid of it and referenced the issues I found, though I believe I had seen other things related to this but didn't find them in my quick search.
I thought we cleaned that up somewhat in d56a434 But I'm not exactly sure what you are asking for, probably because I'm a bit tired at the moment and not reading everything 😟 Not sure if you really meant this commit d7c7911 which first added that '.' -> '%2E' translation. Very little info there besides saying it didn't work with a default gitlab installation. But my PR above is passing all the functional tests without an issues. |
nejch commented Dec 20, 2021
Copy link Copy Markdown
Member
Sorry yes this is what I meant, I just did a quick blame there. 🤦 Ahh interesting: it seems like the underlying issue was fixed in GitLab 13.2 by upgrading the Grape library. Previously GitLab needed |
JohnVillalovos commented Dec 20, 2021
Copy link Copy Markdown
Member
Nice research!!! 👍 |
fix: stop encoding '.' to '%2E'
daa2e65
Forcing the encoding of '.' to '%2E' causes issues. It also goes against the RFC: https://datatracker.ietf.org/doc/html/rfc3986.html#section-2.3 From the RFC: For consistency, percent-encoded octets in the ranges of ALPHA (%41-%5A and %61-%7A), DIGIT (%30-%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should not be created by URI producers... Closes #1006 Related #1356 Related #1561 BREAKING CHANGE: stop encoding '.' to '%2E'. This could potentially be a breaking change for users who have incorrectly configured GitLab servers which don't handle period '.' characters correctly.JohnVillalovos added a commit that referenced this pull request Dec 20, 2021
fix: stop encoding '.' to '%2E'
702e41d
Forcing the encoding of '.' to '%2E' causes issues. It also goes against the RFC: https://datatracker.ietf.org/doc/html/rfc3986.html#section-2.3 From the RFC: For consistency, percent-encoded octets in the ranges of ALPHA (%41-%5A and %61-%7A), DIGIT (%30-%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should not be created by URI producers... Closes #1006 Related #1356 Related #1561 BREAKING CHANGE: stop encoding '.' to '%2E'. This could potentially be a breaking change for users who have incorrectly configured GitLab servers which don't handle period '.' characters correctly.
JohnVillalovos commented Dec 21, 2021
Copy link Copy Markdown
Member
|
@dAnjou Would you be willing to rebase this? I think we fixed the issue that caused the functional tests to fail in a PR that got merged today PR #1766 |
feat(api): support file format for repository archive
85252e4
JohnVillalovos
force-pushed
the
patch-1
branch
from
dafcef1 to
85252e4
Compare
December 21, 2021 16:54
JohnVillalovos commented Dec 21, 2021
Copy link Copy Markdown
Member
I got impatient 😊So I did it myself. |
View reviewed changes
JohnVillalovos enabled auto-merge (rebase) December 21, 2021 16:57 JohnVillalovos merged commit
83dcabf
into
python-gitlab : main
Dec 21, 2021
dAnjou commented Dec 21, 2021
Copy link Copy Markdown
Contributor
Author
|
Thank you, @JohnVillalovos ! Glad the change made it 😊 |