Spaces:
Running
Running
Reupload OmniDev clean version
Browse files- app/api/me/projects/route.ts +13 -8
app/api/me/projects/route.ts
CHANGED
|
@@ -15,15 +15,20 @@ export async function POST(
|
|
| 15 |
|
| 16 |
const { title: titleFromRequest, pages, prompt, initialFiles } = await req.json();
|
| 17 |
|
| 18 |
-
const title = titleFromRequest ?? "
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
const repo: RepoDesignation = {
|
| 29 |
type: "space",
|
|
|
|
| 15 |
|
| 16 |
const { title: titleFromRequest, pages, prompt, initialFiles } = await req.json();
|
| 17 |
|
| 18 |
+
const title = titleFromRequest ?? "OmniDev Project";
|
| 19 |
|
| 20 |
+
let formattedTitle = title
|
| 21 |
+
.toLowerCase()
|
| 22 |
+
.replace(/[^a-z0-9]+/g, "-")
|
| 23 |
+
.split("-")
|
| 24 |
+
.filter(Boolean)
|
| 25 |
+
.join("-")
|
| 26 |
+
.slice(0, 96);
|
| 27 |
+
|
| 28 |
+
// Fallback when non-Latin titles slugify to empty (e.g., Arabic-only)
|
| 29 |
+
if (!formattedTitle || formattedTitle.trim().length === 0) {
|
| 30 |
+
formattedTitle = `project-${Math.random().toString(36).slice(2, 8)}`;
|
| 31 |
+
}
|
| 32 |
|
| 33 |
const repo: RepoDesignation = {
|
| 34 |
type: "space",
|