Spaces:
Running
Running
fix
Browse files
app/api/me/projects/[namespace]/[repoId]/commits/[commitId]/promote/route.ts
CHANGED
|
@@ -129,7 +129,12 @@ export async function POST(
|
|
| 129 |
path: subFileInfo.path,
|
| 130 |
revision: commitId,
|
| 131 |
raw: true
|
| 132 |
-
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
const content = await blob?.text();
|
| 134 |
|
| 135 |
if (content) {
|
|
|
|
| 129 |
path: subFileInfo.path,
|
| 130 |
revision: commitId,
|
| 131 |
raw: true
|
| 132 |
+
}).catch((error) => {
|
| 133 |
+
return null;
|
| 134 |
+
});
|
| 135 |
+
if (!blob) {
|
| 136 |
+
continue;
|
| 137 |
+
}
|
| 138 |
const content = await blob?.text();
|
| 139 |
|
| 140 |
if (content) {
|
app/api/me/projects/[namespace]/[repoId]/download/route.ts
CHANGED
|
@@ -66,7 +66,12 @@ export async function GET(
|
|
| 66 |
accessToken: user.token as string,
|
| 67 |
path: fileInfo.path,
|
| 68 |
raw: true
|
|
|
|
|
|
|
| 69 |
});
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
if (blob) {
|
| 72 |
const arrayBuffer = await blob.arrayBuffer();
|
|
|
|
| 66 |
accessToken: user.token as string,
|
| 67 |
path: fileInfo.path,
|
| 68 |
raw: true
|
| 69 |
+
}).catch((error) => {
|
| 70 |
+
return null;
|
| 71 |
});
|
| 72 |
+
if (!blob) {
|
| 73 |
+
continue;
|
| 74 |
+
}
|
| 75 |
|
| 76 |
if (blob) {
|
| 77 |
const arrayBuffer = await blob.arrayBuffer();
|
app/api/me/projects/[namespace]/[repoId]/route.ts
CHANGED
|
@@ -136,7 +136,12 @@ export async function GET(
|
|
| 136 |
if (allowedFilesExtensions.includes(subFileInfo.path.split(".").pop() || "")) {
|
| 137 |
files.push(`https://huggingface.co/spaces/${namespace}/${repoId}/resolve/main/${subFileInfo.path}`);
|
| 138 |
} else {
|
| 139 |
-
const blob = await downloadFile({ repo, accessToken: user.token as string, path: subFileInfo.path, raw: true })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
const html = await blob?.text();
|
| 141 |
if (!html) {
|
| 142 |
continue;
|
|
|
|
| 136 |
if (allowedFilesExtensions.includes(subFileInfo.path.split(".").pop() || "")) {
|
| 137 |
files.push(`https://huggingface.co/spaces/${namespace}/${repoId}/resolve/main/${subFileInfo.path}`);
|
| 138 |
} else {
|
| 139 |
+
const blob = await downloadFile({ repo, accessToken: user.token as string, path: subFileInfo.path, raw: true }).catch((error) => {
|
| 140 |
+
return null;
|
| 141 |
+
});
|
| 142 |
+
if (!blob) {
|
| 143 |
+
continue;
|
| 144 |
+
}
|
| 145 |
const html = await blob?.text();
|
| 146 |
if (!html) {
|
| 147 |
continue;
|