mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2025-12-24 02:39:18 -05:00
fix(imagecache): fix avatar cache folder creation (#1581)
This fixes a regression caused by #1520 which broke the file extension detection thereby breaking avatars
This commit is contained in:
@@ -3,6 +3,7 @@ import axios from 'axios';
|
||||
import rateLimit, { type rateLimitOptions } from 'axios-rate-limit';
|
||||
import { createHash } from 'crypto';
|
||||
import { promises } from 'fs';
|
||||
import mime from 'mime/lite';
|
||||
import path, { join } from 'path';
|
||||
|
||||
type ImageResponse = {
|
||||
@@ -269,7 +270,10 @@ class ImageProxy {
|
||||
});
|
||||
|
||||
const buffer = Buffer.from(response.data, 'binary');
|
||||
const extension = path.split('.').pop() ?? '';
|
||||
|
||||
const contentType = response.headers['content-type'] || '';
|
||||
const extension = mime.getExtension(contentType) || '';
|
||||
|
||||
let maxAge = Number(
|
||||
(response.headers['cache-control'] ?? '0').split('=')[1]
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user