Changes to file names
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2021-02-24 09:59:41 +01:00
parent 8ddbcc24a7
commit 347ac77878
2 changed files with 3 additions and 8 deletions

View File

@ -54,7 +54,7 @@ module.exports = Self => {
};
await fs.mkdir(dstDir, {recursive: true});
await sharp(srcFilePath, {failOnError: false})
await sharp(srcFilePath)
.resize(collection.maxWidth, collection.maxHeight, resizeOpts)
.png()
.toFile(dstFile);
@ -69,7 +69,7 @@ module.exports = Self => {
};
await fs.mkdir(dstDir, {recursive: true});
await sharp(srcFilePath, {failOnError: false})
await sharp(srcFilePath)
.resize(size.width, size.height, resizeOpts)
.png()
.toFile(dstFile);

View File

@ -47,12 +47,7 @@ module.exports = Self => {
if (!image) return;
const srcFile = image.url.split('/').pop();
const dotIndex = srcFile.lastIndexOf('.');
let fileName = srcFile.substring(0, dotIndex);
if (dotIndex == -1)
fileName = srcFile;
const fileName = srcFile.replace(/\./g, '');
const file = `${fileName}.png`;
const filePath = path.join(tempPath, file);