feat: fix path
This commit is contained in:
parent
4c60b7794b
commit
96304b91a8
|
|
@ -1,8 +1,8 @@
|
|||
import {readFileSync} from "fs";
|
||||
|
||||
export const readOrFetch = async (path: string) => {
|
||||
if (path.indexOf('https') === 0) {
|
||||
return (await fetch(path, {})).arrayBuffer();
|
||||
if (path.indexOf('http') === 0) {
|
||||
return (await fetch(path)).arrayBuffer();
|
||||
}
|
||||
|
||||
return readFileSync(path);
|
||||
|
|
|
|||
|
|
@ -139,10 +139,12 @@ export class PostsService {
|
|||
settings: JSON.parse(p.settings || '{}'),
|
||||
media: (JSON.parse(p.image || '[]') as Media[]).map((m) => ({
|
||||
url:
|
||||
process.env.FRONTEND_URL +
|
||||
'/' +
|
||||
process.env.NEXT_PUBLIC_UPLOAD_STATIC_DIRECTORY +
|
||||
m.path,
|
||||
m.path.indexOf('http') === -1
|
||||
? process.env.FRONTEND_URL +
|
||||
'/' +
|
||||
process.env.NEXT_PUBLIC_UPLOAD_STATIC_DIRECTORY +
|
||||
m.path
|
||||
: m.path,
|
||||
type: 'image',
|
||||
path: process.env.UPLOAD_DIRECTORY + m.path,
|
||||
})),
|
||||
|
|
|
|||
Loading…
Reference in New Issue