Repository navigation
fix(ftp): handle EOF and detect content type from read bytes - #3125
Merged
Merged
Conversation
jyxjjj
approved these changes
Sep 23, 2026
9 of 11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
当客户端向服务器推送 FTP 空文件的时候,FTP 会读取前 512 字节来判断类型。对于空文件来说,这会提前返回
io.EOF表示文件结束,但代码将其判断为错误并返回。这个 PR 让
server/ftp/fsup.go允许读到 EOF,并只用实际读到的字节判断类型这是一个小修复
Related Issues / 关联 Issue
[Feature] FTP 功能增强:支持 UI 开关与配置、新增日志记录及修复创建空文件失败问题 - #3087
Testing / 测试
测试环境:CachyOS Linux(Arch 系,x86_64)
go test ./...我在修改前的客户端上传了一个空文件,返回
550 Issue during transfer: EOF,文件未生成。修复后,使用 FTP admin 账号上传 0 字节文件:返回
226,SIZE为0,下载内容为 0 字节。Checklist / 检查清单
/ 我已阅读 CONTRIBUTING。
/ 我确认此贡献符合仓库许可证、贡献规范和行为准则。
gofmt,go fmt, orprettierwhere applicable./ 我已按适用情况使用
gofmt、go fmt或prettier格式化变更代码。/ 我已在适用情况下请求相关维护者或代码所有者审查。
AI Disclosure / AI 使用声明
本次提交使用
ChatGPT-6-astro-low辅助生成、测试,我已审查对应的代码并且手动进行相关测试。/ 我已审核并验证此 PR 中的所有 AI 辅助内容。
Co-Authored-Byattribution./ 我已确保所有 AI 辅助提交都包含
Co-Authored-By归属信息。/ 我可以在没有任何 AI 工具的情况下重现此 PR 中包含的所有 AI 辅助内容。