This commit is contained in:
tamaina 2023-01-01 18:04:17 +00:00
parent 453ba25af2
commit 038d71988f
1 changed files with 5 additions and 10 deletions

View File

@ -371,16 +371,11 @@ export class FileInfoService {
* Check the file is SVG or not
*/
@bindThis
public async checkSvg(target: string | Buffer) {
public async checkSvg(path: string) {
try {
if (typeof target === 'string') {
const size = await this.getFileSize(target);
const size = await this.getFileSize(path);
if (size > 1 * 1024 * 1024) return false;
return isSvg(await fs.promises.readFile(target));
} else {
if (target.length > 1 * 1024 * 1024) return false;
return isSvg(target);
}
} catch {
return false;
}