{
image != null ? (
- /* @ts-expect-error Upstream type error. */
- // prettier-ignore
-
+
) : null
}
diff --git a/src/lib/ensure-trailing-slash.ts b/src/lib/ensure-trailing-slash.ts
index 12d2c22..4584e46 100644
--- a/src/lib/ensure-trailing-slash.ts
+++ b/src/lib/ensure-trailing-slash.ts
@@ -1,3 +1,7 @@
+const hasFileExtension = /\.\w+?$/;
+
export function ensureTrailingSlash(path: string): string {
+ if (hasFileExtension.test(path)) return path;
+
return path.endsWith("/") ? path : path + "/";
}
diff --git a/src/lib/get-image-import.ts b/src/lib/get-image-import.ts
index 6a9b9b7..48a382c 100644
--- a/src/lib/get-image-import.ts
+++ b/src/lib/get-image-import.ts
@@ -4,11 +4,13 @@ import { assert } from "@acdh-oeaw/lib";
import type { ImageMetadata } from "astro";
const images = import.meta.glob<{ default: ImageMetadata }>(
- "/public/assets/**/*.@(jpeg|jpg|png|svg)",
+ "/public/assets/**/*.@(gif|jpeg|jpg|png|svg)",
);
export function getImageImport(path: string) {
- if (!path.startsWith("/")) return path;
+ /** Upstream type issue. */
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-explicit-any
+ if (!path.startsWith("/")) return path as any;
const publicPath = join("/public", path);
const image = images[publicPath];