mirror of
https://github.com/versia-pub/server.git
synced 2025-12-08 01:08:19 +01:00
Fix file format conversion in MediaBackend class
This commit is contained in:
parent
2d6de3064c
commit
576a5c83db
|
|
@ -41,7 +41,7 @@ class MediaBackend {
|
||||||
switch (fileFormatToConvertTo) {
|
switch (fileFormatToConvertTo) {
|
||||||
case "png":
|
case "png":
|
||||||
return new File(
|
return new File(
|
||||||
[(await sharpCommand.png().toBuffer()).buffer],
|
[(await sharpCommand.png().toBuffer()).buffer] as any,
|
||||||
// Replace the file extension with PNG
|
// Replace the file extension with PNG
|
||||||
name.replace(/\.[^/.]+$/, ".png"),
|
name.replace(/\.[^/.]+$/, ".png"),
|
||||||
{
|
{
|
||||||
|
|
@ -50,7 +50,7 @@ class MediaBackend {
|
||||||
);
|
);
|
||||||
case "webp":
|
case "webp":
|
||||||
return new File(
|
return new File(
|
||||||
[(await sharpCommand.webp().toBuffer()).buffer],
|
[(await sharpCommand.webp().toBuffer()).buffer] as any,
|
||||||
// Replace the file extension with WebP
|
// Replace the file extension with WebP
|
||||||
name.replace(/\.[^/.]+$/, ".webp"),
|
name.replace(/\.[^/.]+$/, ".webp"),
|
||||||
{
|
{
|
||||||
|
|
@ -59,7 +59,7 @@ class MediaBackend {
|
||||||
);
|
);
|
||||||
case "jpeg":
|
case "jpeg":
|
||||||
return new File(
|
return new File(
|
||||||
[(await sharpCommand.jpeg().toBuffer()).buffer],
|
[(await sharpCommand.jpeg().toBuffer()).buffer] as any,
|
||||||
// Replace the file extension with JPEG
|
// Replace the file extension with JPEG
|
||||||
name.replace(/\.[^/.]+$/, ".jpeg"),
|
name.replace(/\.[^/.]+$/, ".jpeg"),
|
||||||
{
|
{
|
||||||
|
|
@ -68,7 +68,7 @@ class MediaBackend {
|
||||||
);
|
);
|
||||||
case "avif":
|
case "avif":
|
||||||
return new File(
|
return new File(
|
||||||
[(await sharpCommand.avif().toBuffer()).buffer],
|
[(await sharpCommand.avif().toBuffer()).buffer] as any,
|
||||||
// Replace the file extension with AVIF
|
// Replace the file extension with AVIF
|
||||||
name.replace(/\.[^/.]+$/, ".avif"),
|
name.replace(/\.[^/.]+$/, ".avif"),
|
||||||
{
|
{
|
||||||
|
|
@ -78,7 +78,7 @@ class MediaBackend {
|
||||||
// Needs special build of libvips
|
// Needs special build of libvips
|
||||||
case "jxl":
|
case "jxl":
|
||||||
return new File(
|
return new File(
|
||||||
[(await sharpCommand.jxl().toBuffer()).buffer],
|
[(await sharpCommand.jxl().toBuffer()).buffer] as any,
|
||||||
// Replace the file extension with JXL
|
// Replace the file extension with JXL
|
||||||
name.replace(/\.[^/.]+$/, ".jxl"),
|
name.replace(/\.[^/.]+$/, ".jxl"),
|
||||||
{
|
{
|
||||||
|
|
@ -87,7 +87,7 @@ class MediaBackend {
|
||||||
);
|
);
|
||||||
case "heif":
|
case "heif":
|
||||||
return new File(
|
return new File(
|
||||||
[(await sharpCommand.heif().toBuffer()).buffer],
|
[(await sharpCommand.heif().toBuffer()).buffer] as any,
|
||||||
// Replace the file extension with HEIF
|
// Replace the file extension with HEIF
|
||||||
name.replace(/\.[^/.]+$/, ".heif"),
|
name.replace(/\.[^/.]+$/, ".heif"),
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue