IO-2008 Include mime type for listed media.

This commit is contained in:
Patrick Fic
2022-08-03 13:27:17 -07:00
parent 3d0791f633
commit 92e7e3ebda
4 changed files with 41 additions and 6 deletions

View File

@@ -8,6 +8,8 @@ import ListableChecker from "../util/listableChecker";
import GenerateUrl from "../util/MediaUrlGen";
import { PathToRoFolder } from "../util/pathGenerators";
import { FolderPaths, JobRelativeFilePath } from "../util/serverInit";
import ft from "file-type";
import core from "file-type/core";
export async function JobsListMedia(req: Request, res: Response) {
const jobid: string = (req.body.jobid || "").trim();
@@ -27,7 +29,13 @@ export async function JobsListMedia(req: Request, res: Response) {
const relativeThumbPath: string = await GenerateThumbnail(
relativeFilePath
);
const type: core.FileTypeResult | undefined = await ft.fromFile(
relativeFilePath
);
return {
type,
src: GenerateUrl([
FolderPaths.StaticPath,
FolderPaths.JobsFolder,
@@ -64,7 +72,12 @@ export async function JobsListMedia(req: Request, res: Response) {
const relativeThumbPath: string = await GenerateThumbnail(
relativeFilePath
);
const type: core.FileTypeResult | undefined = await ft.fromFile(
relativeFilePath
);
return {
type,
src: GenerateUrl([
FolderPaths.StaticPath,
FolderPaths.JobsFolder,