bug de no cargar visualización de archivos de referencia con filenames con caracteres no permitidos
This commit is contained in:
@@ -22,7 +22,7 @@ export const Route = createFileRoute("/_authenticated/archivos")({
|
||||
component: RouteComponent,
|
||||
loader: async () => {
|
||||
const { data, error } = await supabase
|
||||
.from("fine_tuning_referencias")
|
||||
.from("documentos")
|
||||
.select("*")
|
||||
.order("fecha_subida", { ascending: false })
|
||||
.limit(200)
|
||||
@@ -68,9 +68,9 @@ function RouteComponent() {
|
||||
async function remove(id: string) {
|
||||
if (!confirm("¿Eliminar archivo de referencia?")) return
|
||||
const { error } = await supabase
|
||||
.from("fine_tuning_referencias")
|
||||
.from("documentos")
|
||||
.delete()
|
||||
.eq("fine_tuning_referencias_id", id)
|
||||
.eq("documentos_id", id)
|
||||
if (error) return alert(error.message)
|
||||
router.invalidate()
|
||||
}
|
||||
@@ -124,7 +124,7 @@ function RouteComponent() {
|
||||
<div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
|
||||
{filtered.map((r) => (
|
||||
<article
|
||||
key={r.fine_tuning_referencias_id}
|
||||
key={r.documentos_id}
|
||||
className="rounded-2xl border bg-white/70 dark:bg-neutral-900/60 p-4 flex flex-col gap-3"
|
||||
>
|
||||
<header className="min-w-0">
|
||||
@@ -166,7 +166,7 @@ function RouteComponent() {
|
||||
<Button variant="ghost" size="sm" onClick={() => setViewing(r)}>
|
||||
<Icons.Eye className="w-4 h-4 mr-1" /> Ver
|
||||
</Button>
|
||||
<Button variant="ghost" size="sm" onClick={() => remove(r.fine_tuning_referencias_id)}>
|
||||
<Button variant="ghost" size="sm" onClick={() => remove(r.documentos_id)}>
|
||||
<Icons.Trash2 className="w-4 h-4 mr-1" /> Eliminar
|
||||
</Button>
|
||||
</div>
|
||||
@@ -237,21 +237,21 @@ function UploadDialog({
|
||||
try {
|
||||
const payload = await res.json()
|
||||
createdId =
|
||||
payload?.fine_tuning_referencias_id ||
|
||||
payload?.documentos_id ||
|
||||
payload?.id ||
|
||||
payload?.data?.fine_tuning_referencias_id ||
|
||||
payload?.data?.documentos_id ||
|
||||
null
|
||||
} catch { /* noop */ }
|
||||
|
||||
if (createdId && (tags.trim() || fuente.trim() || typeof interno === "boolean")) {
|
||||
await supabase
|
||||
.from("fine_tuning_referencias")
|
||||
.from("documentos")
|
||||
.update({
|
||||
tags: tags.trim() ? tags.split(",").map((s) => s.trim()).filter(Boolean) : undefined,
|
||||
fuente_autoridad: fuente.trim() || undefined,
|
||||
interno,
|
||||
})
|
||||
.eq("fine_tuning_referencias_id", createdId)
|
||||
.eq("documentos_id", createdId)
|
||||
}
|
||||
|
||||
onOpenChange(false)
|
||||
|
||||
Reference in New Issue
Block a user