Skip to content

refactor: 统一连接器的数据传送行为#3083

Merged
kubesphere-prow[bot] merged 1 commit intokubesphere:mainfrom
mumuhhh:main
Apr 23, 2026
Merged

refactor: 统一连接器的数据传送行为#3083
kubesphere-prow[bot] merged 1 commit intokubesphere:mainfrom
mumuhhh:main

Conversation

@mumuhhh
Copy link
Copy Markdown
Contributor

@mumuhhh mumuhhh commented Apr 22, 2026

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Special notes for reviewers:

Does this PR introduced a user-facing change?

none

Additional documentation, usage docs, etc.:


@kubesphere-prow kubesphere-prow Bot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. do-not-merge/release-note-label-needed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 22, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a centralized PutData function in the connector package to handle file uploads via a temporary location, effectively reducing code duplication across the copy and template modules. The review feedback identifies critical type mismatches in the template module where string variables are passed to PutData instead of the required []byte. Furthermore, suggestions were made to improve the PutData implementation by using the path package for remote path consistency, employing && for command chaining, and ensuring temporary file cleanup upon failure.

Comment thread pkg/modules/template/template.go
Comment thread pkg/modules/template/template.go
Comment thread pkg/modules/template/template.go
Comment thread pkg/connector/connector.go
Comment thread pkg/connector/connector.go
@kubesphere-prow
Copy link
Copy Markdown

This PR has multiple commits, and the default merge method is: squash.
You can request commits to be merged using the label: tide/merge-method-merge

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@redscholar
Copy link
Copy Markdown
Contributor

@gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request centralizes the logic for transferring data to remote destinations by introducing a new PutData function in the connector package. This function handles writing to a temporary location and moving the file to its final destination, allowing for the removal of redundant code in the copy and template modules. Review feedback identifies a high-severity shell injection risk in PutData where the destination path is not properly escaped before being used in a shell command. It is recommended to escape single quotes and ensure cross-platform path compatibility by converting paths to Linux-style slashes.

Comment thread pkg/connector/connector.go
Comment thread pkg/connector/connector.go
@sonarqubecloud
Copy link
Copy Markdown

@redscholar
Copy link
Copy Markdown
Contributor

/approve
/lgtm

@kubesphere-prow kubesphere-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Apr 23, 2026
@kubesphere-prow
Copy link
Copy Markdown

LGTM label has been added.

DetailsGit tree hash: 897cf4bcb69b1d5f0cee2c2f617cd4572a455192

@kubesphere-prow
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mumuhhh, redscholar

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubesphere-prow kubesphere-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 23, 2026
@kubesphere-prow kubesphere-prow Bot merged commit 5acc556 into kubesphere:main Apr 23, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. release-note-none size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants