fix: preserve URL scheme when building file URLs#267
Conversation
Changed the URL construction logic to preserve the original URL's scheme and host instead of assuming all URLs are local files. Previously, QUrl::fromLocalFile() was used which would convert any URL to a file:// scheme. Now we maintain the original scheme by creating a copy of the input URL and only modifying its path component. This fix ensures compatibility with various URL schemes (like network protocols, custom schemes) that may be used in the file enumeration system. The change maintains the URL structure while properly constructing the path for child entries. Log: Fixed URL scheme preservation in file enumeration Influence: 1. Test file enumeration with different URL schemes (file://, smb://, etc.) 2. Verify that child file URLs maintain correct scheme and host information 3. Check that network file shares work correctly with the new URL construction 4. Test with custom URL schemes to ensure they are preserved 5. Verify that local file paths still work correctly fix: 构建文件URL时保留URL方案 修改了URL构建逻辑,保留原始URL的方案和主机信息,而不是假定所有URL都是本 地文件。之前使用QUrl::fromLocalFile()会将任何URL转换为file://方案。现在 通过创建输入URL的副本并仅修改其路径组件来维护原始方案。 此修复确保与文件枚举系统中可能使用的各种URL方案(如网络协议、自定义方 案)的兼容性。该更改在正确构建子条目路径的同时维护URL结构。 Log: 修复文件枚举中的URL方案保留问题 Influence: 1. 使用不同的URL方案(file://、smb://等)测试文件枚举 2. 验证子文件URL是否保持正确的方案和主机信息 3. 检查网络文件共享是否与新的URL构建方式正常工作 4. 使用自定义URL方案测试以确保它们被保留 5. 验证本地文件路径是否仍然正常工作 Bug: https://pms.uniontech.com/bug-view-352359.htm
deepin pr auto review这段代码修改的主要目的是在构建子文件或目录的URL时,保留原始URL的 以下是对这段代码的审查意见,包括语法逻辑、代码质量、代码性能和代码安全方面的分析: 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
总结与改进建议这段修改在逻辑上是正确且必要的,修复了非本地文件系统支持的问题。 改进建议:
总体来说,这是一个高质量的修复,主要注意文件名编码和路径安全性即可。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: GongHeng2017, Johnson-zs, max-lvs The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/merge |
|
This pr cannot be merged! (status: unstable) |
|
/forcemerge |
|
This pr force merged! (status: unstable) |
d324d67
into
linuxdeepin:release/eagle
Changed the URL construction logic to preserve the original URL's scheme and host instead of assuming all URLs are local files. Previously, QUrl::fromLocalFile() was used which would convert any URL to a file:// scheme. Now we maintain the original scheme by creating a copy of the input URL and only modifying its path component.
This fix ensures compatibility with various URL schemes (like network protocols, custom schemes) that may be used in the file enumeration system. The change maintains the URL structure while properly constructing the path for child entries.
Log: Fixed URL scheme preservation in file enumeration
Influence:
fix: 构建文件URL时保留URL方案
修改了URL构建逻辑,保留原始URL的方案和主机信息,而不是假定所有URL都是本
地文件。之前使用QUrl::fromLocalFile()会将任何URL转换为file://方案。现在 通过创建输入URL的副本并仅修改其路径组件来维护原始方案。
此修复确保与文件枚举系统中可能使用的各种URL方案(如网络协议、自定义方
案)的兼容性。该更改在正确构建子条目路径的同时维护URL结构。
Log: 修复文件枚举中的URL方案保留问题
Influence:
Bug: https://pms.uniontech.com/bug-view-352359.htm