fixing header #2270

Merged
mfreeman451 merged 1 commit from refs/pull/2270/head into main 2025-10-04 07:18:40 +00:00
mfreeman451 commented 2025-10-04 07:16:06 +00:00 (Migrated from github.com)
Owner

Imported from GitHub pull request.

Original GitHub pull request: #1696
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/1696
Original created: 2025-10-04T07:16:06Z
Original updated: 2025-10-04T07:49:04Z
Original head: carverauto/serviceradar:cicd/cant_publish
Original base: main
Original merged: 2025-10-04T07:18:40Z by @mfreeman451

PR Type

Bug fix


Description

  • Fix HTTP request content length handling in GitHub asset upload

  • Replace manual header setting with proper ContentLength field


Diagram Walkthrough

flowchart LR
  A["HTTP Request Creation"] --> B["Set ContentLength Field"]
  B --> C["Remove Manual Header"]
  C --> D["Proper Content Length Handling"]

File Walkthrough

Relevant files
Bug fix
publish_packages.go
Fix HTTP content length handling                                                 

release/publish_packages.go

  • Set req.ContentLength field directly instead of manual header
  • Remove manual "Content-Length" header setting
  • Improve HTTP request content length handling
+1/-1     

Imported from GitHub pull request. Original GitHub pull request: #1696 Original author: @mfreeman451 Original URL: https://github.com/carverauto/serviceradar/pull/1696 Original created: 2025-10-04T07:16:06Z Original updated: 2025-10-04T07:49:04Z Original head: carverauto/serviceradar:cicd/cant_publish Original base: main Original merged: 2025-10-04T07:18:40Z by @mfreeman451 --- ### **PR Type** Bug fix ___ ### **Description** - Fix HTTP request content length handling in GitHub asset upload - Replace manual header setting with proper ContentLength field ___ ### Diagram Walkthrough ```mermaid flowchart LR A["HTTP Request Creation"] --> B["Set ContentLength Field"] B --> C["Remove Manual Header"] C --> D["Proper Content Length Handling"] ``` <details> <summary><h3> File Walkthrough</h3></summary> <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Bug fix</strong></td><td><table> <tr> <td> <details> <summary><strong>publish_packages.go</strong><dd><code>Fix HTTP content length handling</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> release/publish_packages.go <ul><li>Set <code>req.ContentLength</code> field directly instead of manual header<br> <li> Remove manual "Content-Length" header setting<br> <li> Improve HTTP request content length handling</ul> </details> </td> <td><a href="https://github.com/carverauto/serviceradar/pull/1696/files#diff-638cfa7da020be995c5e05ba794edd1080d194845870a0061688e0b9afbcadc7">+1/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> </details> ___
qodo-code-review[bot] commented 2025-10-04 07:16:21 +00:00 (Migrated from github.com)
Author
Owner

Imported GitHub PR comment.

Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1696#issuecomment-3367984843
Original created: 2025-10-04T07:16:21Z

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
No custom compliance provided

Follow the guide to enable custom compliance check.

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
- Requires Further Human Verification
🏷️ - Compliance label
Imported GitHub PR comment. Original author: @qodo-code-review[bot] Original URL: https://github.com/carverauto/serviceradar/pull/1696#issuecomment-3367984843 Original created: 2025-10-04T07:16:21Z --- ## PR Compliance Guide 🔍 <!-- https://github.com/carverauto/serviceradar/commit/1310d738aa8b8a287ae31008c9a1199c107068ed --> Below is a summary of compliance checks for this PR:<br> <table><tbody><tr><td colspan='2'><strong>Security Compliance</strong></td></tr> <tr><td>🟢</td><td><details><summary><strong>No security concerns identified</strong></summary> No security vulnerabilities detected by AI analysis. Human verification advised for critical code. </details></td></tr> <tr><td colspan='2'><strong>Ticket Compliance</strong></td></tr> <tr><td>⚪</td><td><details><summary>🎫 <strong>No ticket provided </summary></strong> - [ ] Create ticket/issue <!-- /create_ticket --create_ticket=true --> </details></td></tr> <tr><td colspan='2'><strong>Codebase Duplication Compliance</strong></td></tr> <tr><td>⚪</td><td><details><summary><strong>Codebase context is not defined </strong></summary> Follow the <a href='https://qodo-merge-docs.qodo.ai/core-abilities/rag_context_enrichment/'>guide</a> to enable codebase context checks. </details></td></tr> <tr><td colspan='2'><strong>Custom Compliance</strong></td></tr> <tr><td>⚪</td><td><details><summary><strong>No custom compliance provided</strong></summary> Follow the <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/'>guide</a> to enable custom compliance check. </details></td></tr> <tr><td align="center" colspan="2"> <!-- placeholder --> <!-- /compliance --update_compliance=true --> </td></tr></tbody></table> <details><summary>Compliance status legend</summary> 🟢 - Fully Compliant<br> 🟡 - Partial Compliant<br> 🔴 - Not Compliant<br> ⚪ - Requires Further Human Verification<br> 🏷️ - Compliance label<br> </details>
qodo-code-review[bot] commented 2025-10-04 07:17:12 +00:00 (Migrated from github.com)
Author
Owner

Imported GitHub PR comment.

Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1696#issuecomment-3367985444
Original created: 2025-10-04T07:17:12Z

PR Code Suggestions

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Ensure file is read from beginning

Add a call to file.Seek(0, io.SeekStart) before creating the HTTP request to
ensure the file is always read from the beginning.

release/publish_packages.go [439-443]

+	if _, err := file.Seek(0, io.SeekStart); err != nil {
+		return fmt.Errorf("failed to seek to start of asset file: %w", err)
+	}
 	req, err := http.NewRequestWithContext(context.Background(), http.MethodPost, endpoint, file)
 	if err != nil {
 		return err
 	}
 	req.ContentLength = info.Size()

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies a potential robustness issue and proposes adding a file seek to prevent future bugs, even though the issue is not present in the current code.

Low
  • More
Imported GitHub PR comment. Original author: @qodo-code-review[bot] Original URL: https://github.com/carverauto/serviceradar/pull/1696#issuecomment-3367985444 Original created: 2025-10-04T07:17:12Z --- ## PR Code Suggestions ✨ <!-- 1310d73 --> Explore these optional code suggestions: <table><thead><tr><td><strong>Category</strong></td><td align=left><strong>Suggestion&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </strong></td><td align=center><strong>Impact</strong></td></tr><tbody><tr><td rowspan=1>Possible issue</td> <td> <details><summary>Ensure file is read from beginning</summary> ___ **Add a call to <code>file.Seek(0, io.SeekStart)</code> before creating the HTTP request to <br>ensure the file is always read from the beginning.** [release/publish_packages.go [439-443]](https://github.com/carverauto/serviceradar/pull/1696/files#diff-638cfa7da020be995c5e05ba794edd1080d194845870a0061688e0b9afbcadc7R439-R443) ```diff + if _, err := file.Seek(0, io.SeekStart); err != nil { + return fmt.Errorf("failed to seek to start of asset file: %w", err) + } req, err := http.NewRequestWithContext(context.Background(), http.MethodPost, endpoint, file) if err != nil { return err } req.ContentLength = info.Size() ``` `[To ensure code accuracy, apply this suggestion manually]` <details><summary>Suggestion importance[1-10]: 6</summary> __ Why: The suggestion correctly identifies a potential robustness issue and proposes adding a file seek to prevent future bugs, even though the issue is not present in the current code. </details></details></td><td align=center>Low </td></tr> <tr><td align="center" colspan="2"> - [ ] More <!-- /improve --more_suggestions=true --> </td><td></td></tr></tbody></table>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
carverauto/serviceradar!2270
No description provided.