Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: use temp file on same device with mcp file edit#20477

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
code-asher merged 2 commits intomainfromasher/mcp-edit-file
Oct 29, 2025
Merged
Changes fromall 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
4 changes: 3 additions & 1 deletionagent/files.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -250,7 +250,9 @@ func (a *agent) editFile(ctx context.Context, path string, edits []workspacesdk.
transforms[i] = replace.String(edit.Search, edit.Replace)
}

tmpfile, err := afero.TempFile(a.filesystem, "", filepath.Base(path))
Copy link
Member

Choose a reason for hiding this comment

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

Couldn't we pass thefilepath.Dir(path) here instead of the empty string and get almost the same behavior?

https://github.com/spf13/afero/blob/399bb34ad9fd8a252ad1d8bfaef96279b66dc774/ioutil.go#L180-L207

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Holy smokes how did I miss that, thank you! Fixed.

// Create an adjacent file to ensure it will be on the same device and can be
// moved atomically.
tmpfile, err := afero.TempFile(a.filesystem, filepath.Dir(path), filepath.Base(path))
if err != nil {
return http.StatusInternalServerError, err
}
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp