Skip to content

refactor(api): Use new upload API#119

Merged
yuaanlin merged 1 commit intomainfrom
pan93412/zea-4756-cli-upload-v2
Mar 19, 2025
Merged

refactor(api): Use new upload API#119
yuaanlin merged 1 commit intomainfrom
pan93412/zea-4756-cli-upload-v2

Conversation

@pan93412
Copy link
Member

@pan93412 pan93412 commented Mar 19, 2025

Description (required)

Migrate to new upload API.

Related issues & labels (optional)

  • Closes ZEA-4756
  • Suggested label: enhancement

@pan93412 pan93412 self-assigned this Mar 19, 2025
@pan93412 pan93412 requested a review from Copilot March 19, 2025 13:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the upload flow in the API service to migrate to a new upload API. Key changes include the implementation of a SHA256 content hash, replacing multipart form data with JSON requests, and a new multi-step upload process.

Comments suppressed due to low confidence (3)

pkg/api/service.go:412

  • [nitpick] The variable 'createUploadResp' represents an HTTP request, so renaming it (e.g., to 'createUploadReq') would clarify its purpose.
createUploadResp, err := http.NewRequestWithContext(ctx, "POST", constant.ZeaburServerURL+"/v2/upload", bytes.NewReader(createUploadBody))

pkg/api/service.go:480

  • [nitpick] The variable 'prepareResp' is used for an HTTP request. Renaming it to something like 'prepareReq' would help avoid confusion with actual responses.
prepareResp, err := http.NewRequestWithContext(ctx, "POST",

pkg/api/service.go:500

  • The function returns (nil, nil) without returning a valid service object after a successful upload, which may be unintended behavior.
return nil, nil

@yuaanlin yuaanlin merged commit d9125a8 into main Mar 19, 2025
1 of 2 checks passed
@yuaanlin yuaanlin deleted the pan93412/zea-4756-cli-upload-v2 branch March 19, 2025 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants