Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a5ede05d96 | ||
|
|
63746eb090 | ||
|
|
2ca00d032d | ||
|
|
9e1adf4627 |
No files matched your search
@@ -53,6 +53,28 @@ type RowResult = {
|
|||||||
error?: string;
|
error?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Medusa genera el handle por defecto solo en minusculas + espacios a
|
||||||
|
// guiones, sin quitar tildes/enies -- confirmado en vivo: 3 productos
|
||||||
|
// importados con titulo acentuado (ej. "niñas", "Lógicos") quedaron con
|
||||||
|
// handle como "...niñas..." y daban 404 real al entrar por
|
||||||
|
// shop.cruzcloud.net (el tunel/ingress publico rompe rutas con UTF-8
|
||||||
|
// no-ASCII en el path, aunque el mismo request funciona perfecto pegandole
|
||||||
|
// directo al servicio dentro del cluster). Se genera el handle nosotros
|
||||||
|
// mismos, ASCII-only, en vez de dejarselo al default de Medusa. El sufijo
|
||||||
|
// corto evita colisiones entre titulos parecidos/repetidos sin necesidad
|
||||||
|
// de revisar unicidad antes de crear.
|
||||||
|
function slugify(title: string, uniquePart: string): string {
|
||||||
|
const base = title
|
||||||
|
.normalize("NFD")
|
||||||
|
.replace(/[̀-ͯ]/g, "")
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/[^a-z0-9]+/g, "-")
|
||||||
|
.replace(/^-+|-+$/g, "")
|
||||||
|
.slice(0, 80)
|
||||||
|
.replace(/-+$/g, "");
|
||||||
|
return `${base || "producto"}-${uniquePart}`;
|
||||||
|
}
|
||||||
|
|
||||||
function extensionFromContentType(contentType: string | null, url: string): string {
|
function extensionFromContentType(contentType: string | null, url: string): string {
|
||||||
if (contentType?.includes("png")) return "png";
|
if (contentType?.includes("png")) return "png";
|
||||||
if (contentType?.includes("webp")) return "webp";
|
if (contentType?.includes("webp")) return "webp";
|
||||||
@@ -201,6 +223,7 @@ export async function POST(req: MedusaRequest<{ csv: string }>, res: MedusaRespo
|
|||||||
products: [
|
products: [
|
||||||
{
|
{
|
||||||
title,
|
title,
|
||||||
|
handle: slugify(title, `${Date.now().toString(36)}${index}`),
|
||||||
description: row.descripcion || undefined,
|
description: row.descripcion || undefined,
|
||||||
status: "published",
|
status: "published",
|
||||||
thumbnail: uploadedFiles[0]?.url,
|
thumbnail: uploadedFiles[0]?.url,
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ spec:
|
|||||||
memory: 64Mi
|
memory: 64Mi
|
||||||
|
|
||||||
- name: migrations
|
- name: migrations
|
||||||
image: gitea.cruzcloud.net/devops/ecommerce-medusa:v1.0.221
|
image: gitea.cruzcloud.net/devops/ecommerce-medusa:v1.0.222
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
command:
|
command:
|
||||||
- node
|
- node
|
||||||
@@ -86,7 +86,7 @@ spec:
|
|||||||
|
|
||||||
containers:
|
containers:
|
||||||
- name: app
|
- name: app
|
||||||
image: gitea.cruzcloud.net/devops/ecommerce-medusa:v1.0.221
|
image: gitea.cruzcloud.net/devops/ecommerce-medusa:v1.0.222
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
envFrom:
|
envFrom:
|
||||||
- configMapRef:
|
- configMapRef:
|
||||||
|
|||||||
Reference in new issue
Block a user