Skip to content

Conversation

@gqcn
Copy link
Member

@gqcn gqcn commented Mar 26, 2025

fixed #4193

@gqcn gqcn requested review from hailaz, oldme-git and wln32 March 26, 2025 13:33
@gqcn
Copy link
Member Author

gqcn commented Mar 26, 2025

related #4203

@hailaz
Copy link
Contributor

hailaz commented Mar 27, 2025

@gqcn 过不了单测

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@gqcn Can't pass the single test

@houseme houseme requested a review from Copilot March 28, 2025 03:52

This comment was marked as outdated.

@hailaz hailaz requested a review from Copilot September 5, 2025 02:12
Copy link
Contributor

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 fixes a panic that occurs when posting an empty string parameter to *ghttp.UploadFile by improving handling of empty values in the type conversion system. The fix addresses issue #4193 where empty strings were causing conversion failures that led to panics.

  • Adds early return handling for empty strings in float conversion functions
  • Updates error handling in struct conversion to properly propagate errors instead of suppressing them
  • Modifies map conversion logic to return empty maps when mustMapReturn is true for empty inputs
  • Changes default error handling behavior in Scan function to fail fast instead of continuing on errors

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
util/gconv/internal/converter/converter_struct.go Updates error message format and removes fallback conversion that was masking errors
util/gconv/internal/converter/converter_map.go Adds handling for empty strings/bytes to return empty maps when required
util/gconv/internal/converter/converter_float.go Adds empty string checks to return 0 instead of attempting invalid parsing
util/gconv/internal/converter/converter_convert.go Minor variable declaration style change and comment correction
util/gconv/gconv_scan.go Changes default ContinueOnError from true to false for better error visibility
net/ghttp/ghttp_z_unit_issue_test.go Adds test case for the fixed issue and corrects indentation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copilot AI review requested due to automatic review settings January 23, 2026 08:43
Copy link
Contributor

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

net/ghttp: Multipart file upload fails: empty string causes ghttp.UploadFile conversion error

4 participants