diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2021-06-06 01:59:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-06 02:59:27 +0300 |
commit | ee5e1c4a88f2f075587bfbc39438b6d6b1c3044e (patch) | |
tree | 5953d6094edeaa0ff65209ead9cc7a3ad6d753dc /modules/lfs | |
parent | 683cfe39ef2c03f204eb558ba6ec65c2b18b9433 (diff) | |
download | gitea-ee5e1c4a88f2f075587bfbc39438b6d6b1c3044e.tar.gz gitea-ee5e1c4a88f2f075587bfbc39438b6d6b1c3044e.zip |
Rewrite of the LFS server (#15523)
* Restructured code. Moved static checks out of loop.
* Restructured batch api. Add support for individual errors.
* Let router decide if LFS is enabled.
* Renamed methods.
* Return correct status from verify handler.
* Unified media type check in router.
* Changed error code according to spec.
* Moved checks into router.
* Removed invalid v1 api methods.
* Unified methods.
* Display better error messages.
* Added size parameter. Create meta object on upload.
* Use object error on invalid size.
* Skip upload if object exists.
* Moved methods.
* Suppress fields in response.
* Changed error on accept.
* Added tests.
* Use ErrorResponse object.
* Test against message property.
* Add support for the old invalid lfs client.
* Fixed the check because MinIO wraps the error.
* Use individual repositories.
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'modules/lfs')
-rw-r--r-- | modules/lfs/shared.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/modules/lfs/shared.go b/modules/lfs/shared.go index 70b76d7512..9abbf85fbd 100644 --- a/modules/lfs/shared.go +++ b/modules/lfs/shared.go @@ -45,7 +45,7 @@ type BatchResponse struct { // ObjectResponse is object metadata as seen by clients of the LFS server. type ObjectResponse struct { Pointer - Actions map[string]*Link `json:"actions"` + Actions map[string]*Link `json:"actions,omitempty"` Error *ObjectError `json:"error,omitempty"` } @@ -53,7 +53,7 @@ type ObjectResponse struct { type Link struct { Href string `json:"href"` Header map[string]string `json:"header,omitempty"` - ExpiresAt time.Time `json:"expires_at,omitempty"` + ExpiresAt *time.Time `json:"expires_at,omitempty"` } // ObjectError defines the JSON structure returned to the client in case of an error @@ -67,3 +67,10 @@ type PointerBlob struct { Hash string Pointer } + +// ErrorResponse describes the error to the client. +type ErrorResponse struct { + Message string + DocumentationURL string `json:"documentation_url,omitempty"` + RequestID string `json:"request_id,omitempty"` +} |