8000 🐛 Fix listFiles pagination · huggingface/huggingface.js@fa3ad62 · GitHub
[go: up one dir, main page]

Skip to content

Commit fa3ad62

Browse files
committed
🐛 Fix listFiles pagination
The root cause of the problem is in the reponse by HF's api, it will be fixed soon
1 parent 66c47b4 commit fa3ad62

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/hub/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@huggingface/hub",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "Utilities to interact with the Hugging Face hub",
55
"repository": "https://github.com/huggingface/huggingface.js.git",
66
"publishConfig": {

packages/hub/src/lib/list-files.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export async function* listFiles(params: {
4646
yield item;
4747
}
4848

49-
url = json.nextUrl;
49+
url = json.nextUrl
50+
? json.nextUrl?.startsWith(params.hubUrl ?? HUB_URL)
51+
? json.nextUrl
52+
: `${params.hubUrl ?? HUB_URL}${json.nextUrl}`
53+
: undefined;
5054
}
5155
}

0 commit comments

Comments
 (0)
0