Skip to content

Commit 89607a2

Browse files
committed
Removed invalid v1 api methods.
1 parent f3fe4de commit 89607a2

File tree

2 files changed

+0
-83
lines changed

2 files changed

+0
-83
lines changed

routers/routes/web.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,8 +1105,6 @@ func RegisterRoutes(m *web.Route) {
11051105
m.Get("/objects/{oid}/{filename}", lfs.DownloadHandler)
11061106
m.Get("/objects/{oid}", lfs.DownloadHandler)
11071107
m.Put("/objects/{oid}", lfs.UploadHandler)
1108-
m.Any("/objects/{oid}", lfs.CheckAcceptMediaType, lfs.LegacyMetaHandler)
1109-
m.Post("/objects", lfs.CheckAcceptMediaType, lfs.LegacyPostHandler)
11101108
m.Post("/verify/{oid}", lfs.CheckAcceptMediaType, lfs.VerifyHandler)
11111109
m.Group("/locks", func() {
11121110
m.Get("/", lfs.GetListLockHandler)

services/lfs/server.go

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -166,87 +166,6 @@ func DownloadHandler(ctx *context.Context) {
166166
logRequest(ctx.Req, statusCode)
167167
}
168168

169-
// LegacyMetaHandler retrieves metadata about the object
170-
func LegacyMetaHandler(ctx *context.Context) {
171-
rc, p := unpack(ctx)
172-
173-
meta, _ := getAuthenticatedRepoAndMeta(ctx, rc, p, false)
174-
if meta == nil {
175-
// Status already written in getAuthenticatedRepoAndMeta
176-
return
177-
}
178-
179-
ctx.Resp.Header().Set("Content-Type", lfs_module.MediaType)
180-
181-
if ctx.Req.Method == "GET" {
182-
json := jsoniter.ConfigCompatibleWithStandardLibrary
183-
enc := json.NewEncoder(ctx.Resp)
184-
if err := enc.Encode(buildObjectResponse(rc, meta.Pointer, true, false, 0)); err != nil {
185-
log.Error("Failed to encode representation as json. Error: %v", err)
186-
}
187-
}
188-
189-
logRequest(ctx.Req, http.StatusOK)
190-
}
191-
192-
// LegacyPostHandler instructs the client how to upload data
193-
func LegacyPostHandler(ctx *context.Context) {
194-
rc, p := unpack(ctx)
195-
196-
repository, err := models.GetRepositoryByOwnerAndName(rc.User, rc.Repo)
197-
if err != nil {
198-
log.Error("Unable to get repository: %s/%s Error: %v", rc.User, rc.Repo, err)
199-
writeStatus(ctx, http.StatusNotFound)
200-
return
201-
}
202-
203-
if !authenticate(ctx, repository, rc.Authorization, true) {
204-
requireAuth(ctx)
205-
return
206-
}
207-
208-
if !p.IsValid() {
209-
log.Info("Invalid LFS OID[%s] attempt to POST in %s/%s", p.Oid, rc.User, rc.Repo)
210-
writeStatus(ctx, http.StatusNotFound)
211-
return
212-
}
213-
214-
if setting.LFS.MaxFileSize > 0 && p.Size > setting.LFS.MaxFileSize {
215-
log.Info("Denied LFS OID[%s] upload of size %d to %s/%s because of LFS_MAX_FILE_SIZE=%d", p.Oid, p.Size, rc.User, rc.Repo, setting.LFS.MaxFileSize)
216-
writeStatus(ctx, http.StatusRequestEntityTooLarge)
217-
return
218-
}
219-
220-
meta, err := models.NewLFSMetaObject(&models.LFSMetaObject{Pointer: p, RepositoryID: repository.ID})
221-
if err != nil {
222-
log.Error("Unable to write LFS OID[%s] size %d meta object in %v/%v to database. Error: %v", p.Oid, p.Size, rc.User, rc.Repo, err)
223-
writeStatus(ctx, http.StatusNotFound)
224-
return
225-
}
226-
227-
ctx.Resp.Header().Set("Content-Type", lfs_module.MediaType)
228-
229-
sentStatus := http.StatusAccepted
230-
contentStore := lfs_module.NewContentStore()
231-
exist, err := contentStore.Exists(p)
232-
if err != nil {
233-
log.Error("Unable to check if LFS OID[%s] exist on %s / %s. Error: %v", p.Oid, rc.User, rc.Repo, err)
234-
writeStatus(ctx, http.StatusInternalServerError)
235-
return
236-
}
237-
if meta.Existing && exist {
238-
sentStatus = http.StatusOK
239-
}
240-
ctx.Resp.WriteHeader(sentStatus)
241-
242-
json := jsoniter.ConfigCompatibleWithStandardLibrary
243-
enc := json.NewEncoder(ctx.Resp)
244-
if err := enc.Encode(buildObjectResponse(rc, meta.Pointer, meta.Existing, true, 0)); err != nil {
245-
log.Error("Failed to encode representation as json. Error: %v", err)
246-
}
247-
logRequest(ctx.Req, sentStatus)
248-
}
249-
250169
// BatchHandler provides the batch api
251170
func BatchHandler(ctx *context.Context) {
252171
bv := unpackbatch(ctx)

0 commit comments

Comments
 (0)