Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HMS-5380: create_upload fixes #949

Merged
merged 1 commit into from
Jan 22, 2025
Merged
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
17 changes: 12 additions & 5 deletions pkg/handler/repositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,10 @@ func (rh *RepositoryHandler) createUpload(c echo.Context) error {
return ce.NewErrorResponse(http.StatusBadRequest, "Error binding parameters", err.Error())
}

if req.ChunkSize <= 0 {
return ce.NewErrorResponse(http.StatusBadRequest, "Error creating upload", "Chunk size must be greater than 0")
}

domainName, err := ph.DaoRegistry.Domain.FetchOrCreateDomain(c.Request().Context(), orgId)

if err != nil {
Expand Down Expand Up @@ -621,6 +625,7 @@ func (rh *RepositoryHandler) createUpload(c echo.Context) error {
UploadUuid: &existingUUID,
Size: req.ChunkSize,
CompletedChecksums: completedChunks,
ArtifactHref: utils.Ptr(""),
}

return c.JSON(http.StatusCreated, resp)
Expand All @@ -638,11 +643,13 @@ func (rh *RepositoryHandler) createUpload(c echo.Context) error {
}

resp := &api.UploadResponse{
UploadUuid: &uploadUuid,
Created: pulpResp.PulpCreated,
LastUpdated: pulpResp.PulpLastUpdated,
Size: pulpResp.Size,
Completed: pulpResp.Completed,
UploadUuid: &uploadUuid,
Created: pulpResp.PulpCreated,
LastUpdated: pulpResp.PulpLastUpdated,
Size: pulpResp.Size,
Completed: pulpResp.Completed,
ArtifactHref: utils.Ptr(""),
CompletedChecksums: make([]string, 0),
}

return c.JSON(http.StatusCreated, resp)
Expand Down
Loading