Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

fix: add link title when creating via SingleFile extension

Kha Nguyen4acc639a8a66
diff --git a/apps/web/pages/api/v1/archives/index.ts b/apps/web/pages/api/v1/archives/index.ts
index 3459c78f..a51ea633 100644
--- a/apps/web/pages/api/v1/archives/index.ts
+++ b/apps/web/pages/api/v1/archives/index.ts
@@ -10,6 +10,7 @@ import { UploadFileSchema } from "@linkwarden/lib/schemaValidation";
import isDemoMode from "@/lib/api/isDemoMode";
import getSuffixFromFormat from "@/lib/shared/getSuffixFromFormat";
import setCollection from "@/lib/api/setCollection";
+import fetchTitleAndHeaders from "@/lib/shared/fetchTitleAndHeaders";
export const config = {
api: {
@@ -145,9 +146,11 @@ async function handlePost(req: NextApiRequest, res: NextApiResponse) {
if (!collection) {
throw new Error("Collection not found.");
}
+ const { title = "" } = url ? await fetchTitleAndHeaders(url) : {};
const link = await prisma.link.create({
data: {
+ name: title,
createdBy: {
connect: {
id: user.id,