1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-11-24 08:42:24 +02:00

fixing photo name generating #558

This commit is contained in:
Patrik J. Braun 2022-11-21 22:54:35 +01:00
parent e6774bf689
commit 75646a0676

View File

@ -164,7 +164,7 @@ export class PhotoProcessing {
const sizeStr = convertedPath.substring(
convertedPath.lastIndexOf('_') + 1,
convertedPath.length - path.extname(convertedPath).length
convertedPath.lastIndexOf('q')
);
const size = parseInt(sizeStr, 10);
@ -177,6 +177,19 @@ export class PhotoProcessing {
return false;
}
const qualityStr = convertedPath.substring(
convertedPath.lastIndexOf('q') + 1,
convertedPath.length - path.extname(convertedPath).length
);
const quality = parseInt(qualityStr, 10);
if ((quality + '').length !== qualityStr.length ||
quality < 0 ||
quality > 100) {
return false;
}
try {
await fsp.access(origFilePath, fsConstants.R_OK);
} catch (e) {