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>
This commit is contained in:
parent
683cfe39ef
commit
ee5e1c4a88
7 changed files with 759 additions and 439 deletions
|
@ -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"`
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue