-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(drivers/seafile): object not found when RootFolderPath != "/" #2010
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request attempts to fix an "object not found" error that occurs when the Seafile driver's RootFolderPath is set to something other than "/". The fix ensures that listLibraries() is called to populate the libraryMap before it's used by getRepoAndPath().
Changes:
- Modified the
List()function to check if the path equalsRootFolderPath(instead of only checking if path equals "/") - Nested the library list return logic to still check for both
path == "/"andd.RepoId == "" - Ensures
libraryMapis populated when accessing the root path, regardless ofRootFolderPathconfiguration
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ndling and error management
|
我不用seafile,麻烦测试一下 |
这样不行,逻辑应该比如传进来的 dir=/aaa/bbb/ccc,这个 aaa 是 repo,需要先转成 repo_id,然后传给 /api2/repos/<repo_id>/dir?p=bbb%2fccc,所以还是要 libraryMap 的 |
|
你测试了吗 |
试过了,failed get objs: failed to list objs: request failed |
|
拉取最新的再试试,应该没问题了 |
现在四种情况都没问题了(repoid=/!="",rootpath=/!="/") |
Description / 描述
把 listLibraries 的逻辑回退到 v4.1.8,即先判断当前目录是否是 d.RootFolderPath,是就需要执行 d.listLibraries()。
Motivation and Context / 背景
现在的 seafile 如果根目录不是 /,会导致进入目录显示 failed get objs: failed to list objs: object not found。原因是 这个commit 导致根目录不是 / 的时候不会执行 d.listLibraries(),导致 d.libraryMap 是空的。至少需要执行一次 d.listLibraries() 来保证 d.getRepoAndPath(path) 返回的是正确的。
Close #2011
How Has This Been Tested? / 测试
直接打开 seafile 驱动的目录查看。
Checklist / 检查清单
我已阅读 CONTRIBUTING 文档。
go fmtor prettier.我已使用
go fmt或 prettier 格式化提交的代码。我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
我已相应更新了相关仓库(若适用)。