Skip to content

Commit

Permalink
Replace all URLs with their canonical version
Browse files Browse the repository at this point in the history
  • Loading branch information
zephraph authored and gitbutler-client committed Sep 12, 2024
1 parent caf619d commit 07cbabb
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions packages/astro-md/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,8 @@ import { normalizeFrontmatter } from "../my-remark";
import { remarkObsidian } from "../remark-obsidian";
import remarkFrontmatter from "remark-frontmatter";

function isULID(str: string) {
// ULID regex to validate the format
const ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
return ulidRegex.test(str);
}

export const onRequest = defineMiddleware(async (context, next) => {
const fileResolver = async (path: string) => {
if (isULID(path)) return path;
return (await context.locals.runtime.env.KV_MAPPINGS.get(path)) ?? path;
};
const processor = await createMarkdownProcessor({
Expand Down

0 comments on commit 07cbabb

Please sign in to comment.