Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"errors"
"fmt"
"log"
"math"
"net/http"
"net/url"
Expand Down Expand Up @@ -139,6 +140,7 @@ func (s *server) handleBatch(w http.ResponseWriter, r *http.Request) {
must(json.NewEncoder(w).Encode(batch.ErrorResponse{
Message: err.Error(),
}))
log.Println("authorization error:", err)
return
}
}
Expand All @@ -151,6 +153,7 @@ func (s *server) handleBatch(w http.ResponseWriter, r *http.Request) {
Message: "could not parse request",
DocURL: "https://github.com/git-lfs/git-lfs/blob/v2.12.0/docs/api/batch.md#requests",
}))
log.Println("parse error:", "could not parse request")
return
}

Expand All @@ -168,6 +171,7 @@ func (s *server) handleBatch(w http.ResponseWriter, r *http.Request) {
Code: 422,
Message: "oid must be a SHA-256 hash in lower case hexadecimal",
}
log.Println("invalid oid:", "oid must be a SHA-256 hash in lower case hexadecimal")
continue
}

Expand All @@ -178,16 +182,19 @@ func (s *server) handleBatch(w http.ResponseWriter, r *http.Request) {
Code: 404,
Message: err.Error(),
}
log.Println("object not found:", err)
continue
} else if in.Size != int(info.Size) {
out.Error = &batch.ObjectError{
Code: 422,
Message: "found object with wrong size",
}
log.Println("found object with wrong size")
}

href, err := s.client.PresignedGetObject(r.Context(), s.bucket, s.key(in.OID), s.ttl, nil)
if err != nil {
log.Println("PresignedGetObject failed:", err)
panic(err)
}

Expand All @@ -205,6 +212,7 @@ func (s *server) handleBatch(w http.ResponseWriter, r *http.Request) {
Code: 422,
Message: "existing object with wrong size",
}
log.Println("existing object with wrong size")
}
// already exists, omit actions
continue
Expand All @@ -215,6 +223,7 @@ func (s *server) handleBatch(w http.ResponseWriter, r *http.Request) {
Code: 422,
Message: "cannot upload objects larger than 5GB to S3 via LFS basic transfer adapter",
}
log.Println("object too large")
continue
}

Expand Down