Skip to content

fix(onedrive): support recursive listing and download for shared folder shortcuts - #3156

Open
m011 wants to merge 2 commits into
OpenListTeam:mainfrom
m011:fix/onedrive-remoteitem-recursive
Open

m011 wants to merge 2 commits into
OpenListTeam:mainfrom
m011:fix/onedrive-remoteitem-recursive

Conversation

@m011

@m011 m011 commented Oct 2, 2026

Copy link
Copy Markdown

Summary / 摘要

When users add shared folders to their OneDrive via official "Add shortcut to My files", the root item returned by Microsoft Graph API contains a
emoteItem facet rather than a standard native folder facet.

Previously, attempting to access subdirectories or files within such shortcuts resulted in:

  • 422 Unprocessable Entity ("Children cannot be listed from an item that is not a folder")
  • 404 ItemNotFound

This change:

  • Resolves remoteItem ancestor targets in paths to query the target drive scope via /drives/{driveId}/items/{itemId}:{subPath}:/children.

  • Enables multi-level recursive navigation and pagination across all shortcut subfolders.

  • Properly resolves direct download links for nested files inside shared shortcuts.

  • 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 需要关联仓库同步修改。

Testing / 测试

  • go test ./...
  • Manual test / 手动测试:
    • Verified Level 1 shortcut root (/Program, 316 items with pagination across multiple pages)
    • Verified Level 2 nested subdirectory (/Program/dir1, 155 items)
    • Verified Level 3 deep nested subdirectory (/Program/dir1/dir2, 116 items)
    • Verified direct link resolution and range partial download for nested files

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. / 我已按适用情况使用 gofmt、go fmt 或 prettier 格式化变更代码。
  • 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 / 使用工具:

  • Claude

Usage scope / 使用范围:
Assisted in analyzing Microsoft Graph API remoteItem responses and implementing recursive drive path resolution.

colin added 2 commits October 2, 2026 11:33
…er shortcuts

When users add shared folders to their OneDrive via official "Add shortcut to My files",
the root item returned by Microsoft Graph API contains a remoteItem facet rather than a
standard native folder facet.

Previously, attempting to access subdirectories or files within such shortcuts resulted in
422 Unprocessable Entity ("Children cannot be listed from an item that is not a folder")
or 404 ItemNotFound because requests were addressed directly against /me/drive/root.

This change:
- Resolves remoteItem ancestor targets in paths to query the target drive scope
  via /drives/{driveId}/items/{itemId}:{subPath}:/children.
- Enables multi-level recursive navigation and pagination across all shortcut subfolders.
- Properly resolves direct download links for nested files inside shared shortcuts.
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.

1 participant