|
|
|
|
@ -55,9 +55,7 @@ func jsonResponse(ctx *context.Context, status int, obj any) {
|
|
|
|
|
// https://github.com/conan-io/conan/issues/6613
|
|
|
|
|
ctx.Resp.Header().Set("Content-Type", "application/json")
|
|
|
|
|
ctx.Status(status)
|
|
|
|
|
if err := json.NewEncoder(ctx.Resp).Encode(obj); err != nil {
|
|
|
|
|
log.Error("JSON encode: %v", err)
|
|
|
|
|
}
|
|
|
|
|
_ = json.NewEncoder(ctx.Resp).Encode(obj)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func apiError(ctx *context.Context, status int, obj any) {
|
|
|
|
|
@ -392,7 +390,6 @@ func uploadFile(ctx *context.Context, fileFilter container.Set[string], fileKey
|
|
|
|
|
if isConanfileFile {
|
|
|
|
|
metadata, err := conan_module.ParseConanfile(buf)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Error("Error parsing package metadata: %v", err)
|
|
|
|
|
apiError(ctx, http.StatusInternalServerError, err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
@ -418,7 +415,6 @@ func uploadFile(ctx *context.Context, fileFilter container.Set[string], fileKey
|
|
|
|
|
} else {
|
|
|
|
|
info, err := conan_module.ParseConaninfo(buf)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Error("Error parsing conan info: %v", err)
|
|
|
|
|
apiError(ctx, http.StatusInternalServerError, err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|