Spaces:
Running
Running
load all folders and files
Browse files
app/api/me/projects/[namespace]/[repoId]/route.ts
CHANGED
|
@@ -126,9 +126,11 @@ export async function GET(
|
|
| 126 |
});
|
| 127 |
}
|
| 128 |
}
|
| 129 |
-
if (fileInfo.type === "directory"
|
| 130 |
for await (const subFileInfo of listFiles({repo, accessToken: user.token as string, path: fileInfo.path})) {
|
| 131 |
-
if (subFileInfo.path.
|
|
|
|
|
|
|
| 132 |
const blob = await downloadFile({ repo, accessToken: user.token as string, path: subFileInfo.path, raw: true });
|
| 133 |
const html = await blob?.text();
|
| 134 |
if (!html) {
|
|
@@ -138,8 +140,6 @@ export async function GET(
|
|
| 138 |
path: subFileInfo.path,
|
| 139 |
html,
|
| 140 |
});
|
| 141 |
-
} else if (allowedFilesExtensions.includes(subFileInfo.path.split(".").pop() || "")) {
|
| 142 |
-
files.push(`https://huggingface.co/spaces/${namespace}/${repoId}/resolve/main/${subFileInfo.path}`);
|
| 143 |
}
|
| 144 |
}
|
| 145 |
}
|
|
|
|
| 126 |
});
|
| 127 |
}
|
| 128 |
}
|
| 129 |
+
if (fileInfo.type === "directory") {
|
| 130 |
for await (const subFileInfo of listFiles({repo, accessToken: user.token as string, path: fileInfo.path})) {
|
| 131 |
+
if (allowedFilesExtensions.includes(subFileInfo.path.split(".").pop() || "")) {
|
| 132 |
+
files.push(`https://huggingface.co/spaces/${namespace}/${repoId}/resolve/main/${subFileInfo.path}`);
|
| 133 |
+
} else {
|
| 134 |
const blob = await downloadFile({ repo, accessToken: user.token as string, path: subFileInfo.path, raw: true });
|
| 135 |
const html = await blob?.text();
|
| 136 |
if (!html) {
|
|
|
|
| 140 |
path: subFileInfo.path,
|
| 141 |
html,
|
| 142 |
});
|
|
|
|
|
|
|
| 143 |
}
|
| 144 |
}
|
| 145 |
}
|