feat: use better names for md files
This commit is contained in:
@@ -2,7 +2,12 @@ import { Handlers } from "$fresh/server.ts";
|
||||
import { json } from "@lib/helpers.ts";
|
||||
import * as tmdb from "@lib/tmdb.ts";
|
||||
import { fileExtension } from "https://deno.land/x/file_extension@v2.1.0/mod.ts";
|
||||
import { formatDate, isString, safeFileName } from "@lib/string.ts";
|
||||
import {
|
||||
formatDate,
|
||||
isString,
|
||||
safeFileName,
|
||||
toUrlSafeString,
|
||||
} from "@lib/string.ts";
|
||||
import { AccessDeniedError, BadRequestError } from "@lib/errors.ts";
|
||||
import { createResource, fetchResource } from "@lib/marka/index.ts";
|
||||
import { ReviewResource } from "@lib/marka/schema.ts";
|
||||
@@ -59,9 +64,9 @@ export const handler: Handlers = {
|
||||
keywords,
|
||||
};
|
||||
|
||||
const fileName = `${safeFileName(name)}.md`;
|
||||
const fileName = toUrlSafeString(name);
|
||||
|
||||
await createResource(`movies/${fileName}`, movie);
|
||||
await createResource(`movies/${fileName}.md`, movie);
|
||||
|
||||
return json({ name: fileName });
|
||||
},
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
import { FreshContext, Handlers } from "$fresh/server.ts";
|
||||
import { fileExtension } from "https://deno.land/x/file_extension@v2.1.0/mod.ts";
|
||||
import * as tmdb from "@lib/tmdb.ts";
|
||||
import { formatDate, isString, safeFileName } from "@lib/string.ts";
|
||||
import {
|
||||
formatDate,
|
||||
isString,
|
||||
safeFileName,
|
||||
toUrlSafeString,
|
||||
} from "@lib/string.ts";
|
||||
import { json } from "@lib/helpers.ts";
|
||||
import {
|
||||
AccessDeniedError,
|
||||
@@ -78,7 +83,7 @@ const POST = async (
|
||||
movie.content.image = finalPath;
|
||||
}
|
||||
|
||||
await createResource(`movies/${safeFileName(movie.name)}.md`, movie);
|
||||
await createResource(`movies/${toUrlSafeString(movie.name)}.md`, movie);
|
||||
|
||||
createRecommendationResource(movie, movieDetails.overview);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user