mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
fixing photo name generating #558
This commit is contained in:
parent
e6774bf689
commit
75646a0676
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user