You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ProjectFileManager does not implement head method to meet API spec #2976
Should return 200 and file metadata. The same request as a GET request returns 200, and they follow the same URL path and parameter requirements. Sending a GET request logs this URL path:
A HTTP HEAD request is sent with the following URL path: DEBUG:urllib3.connectionpool:https://gitlab.com:443 "HEAD /api/v4/projects/1/repository/files?file_path=somefile.txt&ref=HEAD HTTP/11" 404 0
Working GET for master ref DEBUG:urllib3.connectionpool:https://gitlab.com:443 "GET /api/v4/projects/1/repository/files/somefile.txt?ref=master HTTP/11" 200 417
Failing HEAD for master ref DEBUG:urllib3.connectionpool:https://gitlab.com:443 "HEAD /api/v4/projects/1/repository/files?file_path=somefile.txt&ref=master HTTP/11" 404 0
I'm pretty sure this is because GetMixin is inheriting HeadMixin and in ProjectFileManager we are overriding the get method, but that wouldn't override the default head method as far as I'm aware
As a note. Your python-gitlab version is fairly old.
This almost seems like an issue with GitLab. But not sure. Would be interesting to try a curl test using both GET and HEAD. If only HEAD fails then something wrong with GitLab. If they both work then something happening with python-gitlab.
Edit: Notice that the URLs set are slightly different. So pointing more toward python-gitlab
I think #2976 (comment) is right as you can see the file path gets passed as a query param unfortunately in the head() call. I guess we can't rely on this being consistent across the API endpoints.
@JohnVillalovos@holysoles might also be a good idea to not inherit from GetMixin in that case if we're overriding it, to avoid this kind of confusion in the future. Not sure if there's any other implication there.
Activity
JohnVillalovos commentedon Sep 11, 2024
That doesn't seem to be a
HEADrequest. It is aGETrequest that is asking for the ref calledHEADholysoles commentedon Sep 11, 2024
@JohnVillalovos its a HEAD request asking for the HEAD ref. I can generate additional logs for other refs.
holysoles commentedon Sep 11, 2024
Working GET for master ref
DEBUG:urllib3.connectionpool:https://gitlab.com:443 "GET /api/v4/projects/1/repository/files/somefile.txt?ref=master HTTP/11" 200 417Failing HEAD for master ref
DEBUG:urllib3.connectionpool:https://gitlab.com:443 "HEAD /api/v4/projects/1/repository/files?file_path=somefile.txt&ref=master HTTP/11" 404 0holysoles commentedon Sep 11, 2024
I'm pretty sure this is because
GetMixinis inheritingHeadMixinand inProjectFileManagerwe are overriding thegetmethod, but that wouldn't override the defaultheadmethod as far as I'm awareJohnVillalovos commentedon Sep 11, 2024
As a note. Your python-gitlab version is fairly old.
This almost seems like an issue with GitLab. But not sure. Would be interesting to try a
curltest using both GET and HEAD. If only HEAD fails then something wrong with GitLab. If they both work then something happening with python-gitlab.Edit: Notice that the URLs set are slightly different. So pointing more toward python-gitlab
nejch commentedon Sep 11, 2024
I think #2976 (comment) is right as you can see the file path gets passed as a query param unfortunately in the
head()call. I guess we can't rely on this being consistent across the API endpoints.holysoles commentedon Sep 11, 2024
@JohnVillalovos i can update my version and test again, but I've tested this commit and it works. Happy to open a PR if appropriate
Wasnt sure if i should explicitly inherit
HeadMixinor not in it.JohnVillalovos commentedon Sep 11, 2024
Thanks. I was confused as original message had
holysoles commentedon Sep 11, 2024
Also apologies, my version is 4.9.0, i grabbed the wrong dependency version from my requirements file
JohnVillalovos commentedon Sep 11, 2024
PR sounds like a good idea. Thanks.
nejch commentedon Sep 11, 2024
@JohnVillalovos @holysoles might also be a good idea to not inherit from GetMixin in that case if we're overriding it, to avoid this kind of confusion in the future. Not sure if there's any other implication there.
holysoles commentedon Sep 12, 2024
I should be able to get the PR opened tomorrow after I functionally test my update, but its passing unit tests