mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 00:20:25 +08:00 
			
		
		
		
	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:
		@@ -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"`
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user