diff --git a/docker-compose.yml b/docker-compose.yml index f1ff559..63a8740 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,7 +11,8 @@ services: environment: - DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgres:5432/postgres restart: always - image: ghcr.io/linkwarden/linkwarden:latest + # build: . # uncomment this line to build from source + image: ghcr.io/linkwarden/linkwarden:latest # comment this line to build from source ports: - 3000:3000 volumes: diff --git a/lib/api/archiveHandler.ts b/lib/api/archiveHandler.ts index a1516fb..ce919b3 100644 --- a/lib/api/archiveHandler.ts +++ b/lib/api/archiveHandler.ts @@ -50,11 +50,11 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) { let imageExtension = "png"; if (!link.url) linkType = link.type; - else if (contentType === "application/pdf") linkType = "pdf"; + else if (contentType?.includes("application/pdf")) linkType = "pdf"; else if (contentType?.startsWith("image")) { linkType = "image"; - if (contentType === "image/jpeg") imageExtension = "jpeg"; - else if (contentType === "image/png") imageExtension = "png"; + if (contentType.includes("image/jpeg")) imageExtension = "jpeg"; + else if (contentType.includes("image/png")) imageExtension = "png"; } const user = link.collection?.owner; diff --git a/package.json b/package.json index 7b6aaa2..5f2977d 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "crypto-js": "^4.2.0", "csstype": "^3.1.2", "dompurify": "^3.0.6", + "dotenv": "^16.3.1", "eslint": "8.46.0", "eslint-config-next": "13.4.9", "formidable": "^3.5.1", diff --git a/scripts/worker.ts b/scripts/worker.ts index e84b972..de025ea 100644 --- a/scripts/worker.ts +++ b/scripts/worker.ts @@ -1,3 +1,4 @@ +import 'dotenv/config'; import { Collection, Link, User } from "@prisma/client"; import { prisma } from "../lib/api/db"; import archiveHandler from "../lib/api/archiveHandler"; diff --git a/yarn.lock b/yarn.lock index a097607..3ca11e1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2714,6 +2714,11 @@ dompurify@^3.0.6: resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.0.6.tgz#925ebd576d54a9531b5d76f0a5bef32548351dae" integrity sha512-ilkD8YEnnGh1zJ240uJsW7AzE+2qpbOUYjacomn3AvJ6J4JhKGSZ2nh4wUIXPZrEPppaCLx5jFe8T89Rk8tQ7w== +dotenv@^16.3.1: + version "16.3.1" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.1.tgz#369034de7d7e5b120972693352a3bf112172cc3e" + integrity sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ== + ecc-jsbn@~0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9"