-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Add return type to GetRawFileOrLFS and GetRawFile #31680
Conversation
Document return type for the endpoints that fetch specific files from a repository. This allows the swagger generated code to read the returned data.
While the interface is now working and getting the file content, I seem to be getting an error
I'll convert this to draft as I investigate the cause. |
I've found a potential issue here. Not with the fix but what it entails. Currently, the swagger generated code doesn't have ability to consume the Body since it's not parsed. By adding the return type to file, it's possible to pass the writer that then can consume the Body. Swagger generated code uses returned mime-type to determine the type of consumer it allocates. So for text/plain mime, it allocates TextConsumer. Then this complains as above unless there is a trivial TextUnmarshaller() . This means that it may be possible to fix these weird issues by hardcoding "application/octet-stream" as the file type instead of trying to detect it in the Gitea's GetRawFile() endpoints. I'll try that tomorrow. TL;DR: bugs everywhere and not in Gitea 😄 |
@AdamMajer If you want to wait with merging, please put PR into draft status :) |
It's OK to get this merged. The other problem here is with go-swagger and mime-type combinations. It should be addressed elsewhere. |
* giteaofficial/main: Make GetRepositoryByName more safer (go-gitea#31712) [skip ci] Updated licenses and gitignores Run `go-install` in `deps-tools` in parallel (go-gitea#31711) Hide the "Details" link of commit status when the user cannot access actions (go-gitea#30156) Enable `no-jquery/no-parse-html-literal` and fix violation (go-gitea#31684) [skip ci] Updated translations via Crowdin OIDC: case-insensitive comparison for auth scheme `Basic` (go-gitea#31706) Support `pull_request_target` event for commit status (go-gitea#31703) Add types to fetch,toast,bootstrap,svg (go-gitea#31627) Run `detectWebAuthnSupport` only if necessary (go-gitea#31691) add `username` to OIDC introspection response (go-gitea#31688) Add return type to GetRawFileOrLFS and GetRawFile (go-gitea#31680) Support delete user email in admin panel (go-gitea#31690) Use GetDisplayName() instead of DisplayName() to generate rss feeds (go-gitea#31687)
Document return type for the endpoints that fetch specific files from a repository. This allows the swagger generated code to read the returned data.