Skip to content

fix(189pc): preserve file extension during family transfer - #3083

Open
qcnhy wants to merge 2 commits into
OpenListTeam:mainfrom
qcnhy:fix/189pc-family-transfer-extension
Open

qcnhy wants to merge 2 commits into
OpenListTeam:mainfrom
qcnhy:fix/189pc-family-transfer-extension

Conversation

@qcnhy

@qcnhy qcnhy commented Sep 14, 2026

Copy link
Copy Markdown

Summary / 摘要

  • Preserve the source file extension in the temporary upload name used by 189CloudPC family transfer.

  • Fall back to .transfer when the source file has no extension.

  • Add unit coverage for common, uppercase, compound, and extensionless file names.

  • This allows the remote service to classify images when they are first created, while leaving the existing transfer and final rename flow unchanged.

  • This PR has breaking changes.
    / 此 PR 包含破坏性变更。

  • This PR changes public API, config, storage format, or migration behavior.
    / 此 PR 修改了公开 API、配置、存储格式或迁移行为。

  • This PR requires corresponding changes in related repositories.
    / 此 PR 需要关联仓库同步修改。

Related repository PRs / 关联仓库 PR: None.

Related Issues / 关联 Issue

Closes #3081

Testing / 测试

  • go test ./...
  • go test -vet=off ./drivers/189pc
  • Manual test / 手动测试: Not completed because the available test account reported insufficient family-cloud storage before creating the test file.

Checklist / 检查清单

  • I have read CONTRIBUTING.
    / 我已阅读 CONTRIBUTING
  • I confirm this contribution follows the repository license, contribution policy, and code of conduct.
    / 我确认此贡献符合仓库许可证、贡献规范和行为准则。
  • I have formatted the changed code with gofmt, go fmt, or prettier where applicable.
    / 我已按适用情况使用 gofmtgo fmtprettier 格式化变更代码。
  • I have requested review from relevant maintainers or code owners where applicable.
    / 我已在适用情况下请求相关维护者或代码所有者审查。

AI Disclosure / AI 使用声明

  • This PR includes AI-assisted content.
    / 此 PR 包含 AI 辅助内容。

Tools used / 使用工具:

  • ChatGPT
  • Codex
  • GitHub Copilot
  • Claude
  • Gemini
  • Other (please specify) / 其他(请注明):

Usage scope / 使用范围:

  • Code generation / 代码生成

  • Refactoring / 重构

  • Documentation / 文档

  • Tests / 测试

  • Translation / 翻译

  • Review assistance / 审查辅助

  • I have reviewed and validated all AI-assisted content included in this PR.
    / 我已审核并验证此 PR 中的所有 AI 辅助内容。

  • I have ensured that all AI-assisted commits include Co-Authored-By attribution.
    / 我已确保所有 AI 辅助提交都包含 Co-Authored-By 归属信息。

  • I can reproduce all AI-assisted content included in this PR without any AI tools.
    / 我可以在没有任何 AI 工具的情况下重现此 PR 中包含的所有 AI 辅助内容。

- Preserve the source extension in family-transfer temporary upload names.
- Fall back to .transfer for extensionless source files.
- Add unit coverage for extension handling.

Co-authored-by: Codex <267193182+codex@users.noreply.github.com>
@ILoveScratch2

Copy link
Copy Markdown
Member

Real testing is needed.

@qcnhy

qcnhy commented Sep 15, 2026

Copy link
Copy Markdown
Author

I completed a real-world test with the PR commit deployed on an Android ARM64 host.

Test procedure:

  1. Configured an 189CloudPC personal-cloud storage with family_transfer enabled.
  2. Copied an existing PNG file (560,109 bytes) from another mounted storage into it through OpenList.
  3. Waited for the copy task to finish successfully.
  4. Forced a refresh of the destination directory and queried the resulting file metadata.
  5. Requested the thumbnail URL returned by the driver.

Result with this patch:

  • The copy task completed with 100% progress and no error.
  • The final file kept its .png extension and was reported as an image.
  • The returned thumb field was non-empty.
  • Fetching the thumbnail returned HTTP 200 with an image content type and a non-empty response body.
  • A file created by the previous build from the same source had an empty thumb field and could not be previewed, which initially caused confusion during verification.

This confirms that preserving the extension during the family-cloud temporary upload allows the remote service to generate a working preview for the transferred image.

@jyxjjj

jyxjjj commented Sep 19, 2026

Copy link
Copy Markdown
Member

The resume key only uses session and MD5. A canceled .jpg upload can be reused for identical .txt data, leaving the server-side type as image. Could we include the extension in the key?

- Separate resumable upload state for identical content with different extensions.
- Preserve resume behavior when only the temporary file name changes.
- Add unit coverage for both cases.

Co-authored-by: Codex <267193182+codex@users.noreply.github.com>
@qcnhy

qcnhy commented Sep 20, 2026

Copy link
Copy Markdown
Author

Thanks for catching this. I updated the resumable upload key to include path.Ext(file.GetName()) in addition to the session key and file MD5.

This prevents identical .jpg and .txt content from sharing a canceled upload session, while still allowing retries with a different temporary UUID to resume when the extension is unchanged.

I also added a unit test covering both cases:

  • identical session and MD5 with different extensions produce different progress keys;
  • identical session, MD5, and extension with different file names produce the same progress key.

Tested with:

go test -count=1 -vet=off ./drivers/189pc

@pikachuren pikachuren left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🙏 感谢 @qcnhy 提交!
🤖 AI 自动审核声明:本评审报告由 AI 自动生成,当前使用 Claude Opus 5 模型进行分析。
⚠️ AI 分析结果仅供参考,可能存在误判或遗漏。如您发现任何问题或有不同意见,欢迎随时提出讨论和纠正。
⚠️ 重要提醒:即使 AI 评审认为代码质量良好且建议合并,最终是否合并仍需由项目维护者进行人工判定。项目维护者会综合考虑代码质量、项目规划、技术方向、团队资源等多方面因素做出是否合并的决策。

🎯 结论

✅ Approve — 代码质量良好,建议合并

📖 概要

fix(189pc): preserve file extension during family transfer

📊 评审结果

改动合理,无重大问题发现。代码逻辑清晰,符合项目规范。

🎯 结论:✅ Approve — 建议合并

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.

[BUG] 189CloudPC 家庭云转存使用 .transfer 临时后缀,导致图片无法预览

4 participants