fix: post images with as correct arraybuffer to marka
This commit is contained in:
@@ -17,9 +17,9 @@ export async function createResource(
|
|||||||
path: string,
|
path: string,
|
||||||
content: string | object | ArrayBuffer,
|
content: string | object | ArrayBuffer,
|
||||||
) {
|
) {
|
||||||
const isJson = typeof content === "object";
|
const isJson = typeof content === "object" &&
|
||||||
|
!(content instanceof ArrayBuffer);
|
||||||
const fetchUrl = `${url}/${path}`;
|
const fetchUrl = `${url}/${path}`;
|
||||||
console.log("Creating resource", { fetchUrl, content, isJson });
|
|
||||||
const response = await fetch(fetchUrl, {
|
const response = await fetch(fetchUrl, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ export const handler: Handlers = {
|
|||||||
if (posterPath) {
|
if (posterPath) {
|
||||||
const poster = await tmdb.getMoviePoster(posterPath);
|
const poster = await tmdb.getMoviePoster(posterPath);
|
||||||
const extension = fileExtension(posterPath);
|
const extension = fileExtension(posterPath);
|
||||||
|
|
||||||
finalPath = `movies/images/${safeFileName(name)}_cover.${extension}`;
|
finalPath = `movies/images/${safeFileName(name)}_cover.${extension}`;
|
||||||
await createResource(finalPath, poster);
|
await createResource(finalPath, poster);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user