Skip to content

fix(teldrive): avoid index out of range panic when listing an empty dir#2585

Open
SAY-5 wants to merge 1 commit into
OpenListTeam:mainfrom
SAY-5:fix-teldrive-empty-dir-panic
Open

fix(teldrive): avoid index out of range panic when listing an empty dir#2585
SAY-5 wants to merge 1 commit into
OpenListTeam:mainfrom
SAY-5:fix-teldrive-empty-dir-panic

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented Jun 6, 2026

Summary / 摘要

When a Teldrive folder is empty the API returns totalPages: 0, so List sized pagesData to length 0 and then panicked on pagesData[0]. This made copying into an empty Teldrive directory (and listing one) crash with index out of range [0] with length 0. Returning early for the no-pages case fixes it; added a regression test that drives List against an empty-listing response.

  • This PR has breaking changes.
  • This PR changes public API, config, storage format, or migration behavior.
  • This PR requires corresponding changes in related repositories.

Related Issues / 关联 Issue

Closes #2538

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
Copy link
Copy Markdown
Member

@jyxjjj jyxjjj left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution.

This pull request has been approved. However, before it can be merged, please update the PR description to match our default template. Do not remove any existing content; only reorganize or supplement it as needed to fit the template.

Thank you.

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] Teldrive 驱动 List 空列表时 panic: index out of range [0] with length 0

2 participants