Skip to content

fix(terabox): normalize empty dir to / for dm domain API - #9630

Open
FahadBinHussain wants to merge 1 commit into
AlistGo:mainfrom
FahadBinHussain:fix/terabox-empty-dir-dm-api
Open

fix(terabox): normalize empty dir to / for dm domain API#9630
FahadBinHussain wants to merge 1 commit into
AlistGo:mainfrom
FahadBinHussain:fix/terabox-empty-dir-dm-api

Conversation

@FahadBinHussain

Copy link
Copy Markdown

TeraBox migrated its API from \www.terabox.com\ to \dm.terabox.com. The driver already has a redirect handler (errno -6 -> \Url-Domain-Prefix\ header) that switches base_url to the dm domain, but the new dm API rejects an empty \dir\ param with \�rrno: 2.

When listing the storage root, \List()\ passes an empty dir string (the root object's path within the storage is empty). The old \www.terabox.com\ API tolerated this; \dm.terabox.com\ requires \dir=/.

This one-line fix normalizes empty dir to /\ in \getFiles()\ before the API call. Without it, listing the root returns 0 files, which also breaks WebDAV MKCOL+PUT (parent dir lookup fails).

Tested against a live TeraBox account: after the fix, \ s/list\ returns the real files and WebDAV upload works.

TeraBox migrated its API from www.terabox.com to dm.terabox.com.
The driver's redirect handler (errno -6 -> Url-Domain-Prefix
header) already handles the domain migration, but the new dm API
rejects an empty dir param with errno: 2 (invalid path).

When listing the storage root, the driver's List() passes an empty
dir string (since the root object's path within the storage is
empty). The old www.terabox.com API tolerated this, but dm.terabox.com
requires dir=/ for the root.

Fix: normalize empty dir to / in getFiles() before making the API
call. This is a one-line change.
@FahadBinHussain
FahadBinHussain force-pushed the fix/terabox-empty-dir-dm-api branch from e7d1e2d to 4145602 Compare August 24, 2026 06:00
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.

2 participants