Skip to content

Commit

Permalink
Fixed issue Lymphatus#234
Browse files Browse the repository at this point in the history
  • Loading branch information
EpicGazel authored Dec 21, 2023
1 parent a4f77a6 commit 9c33445
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/models/CImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,16 +244,21 @@ bool CImage::compress(const CompressionOptions& compressionOptions)

if (!outputIsBiggerThanInput) {
inputCopyFile = tempFileFullPath;
bool copyResult = QFile::copy(inputCopyFile, outputFullPath);
} else {
this->status = CImageStatus::WARNING;
this->additionalInfo = QIODevice::tr("Skipped: compressed file is bigger than original");
// Overwrite output file name with original file name to avoid broken extension (ex: .png named .webp)
fullFileName = inputFileInfo.filename()
outputFullPath = outputDir.absoluteFilePath(fullFileName);
bool copyResult = QFile::copy(inputCopyFile, outputFullPath);
if (outputAlreadyExists) {
QFileInfo outputFileInfo = QFileInfo(outputFullPath);
this->setCompressedInfo(outputFileInfo);
return true;
}
}
bool copyResult = QFile::copy(inputCopyFile, outputFullPath);

if (!copyResult) {
qCritical() << "Failed to copy from" << inputCopyFile << "to" << outputFullPath;
this->additionalInfo = QIODevice::tr("Cannot copy output file, check your permissions");
Expand Down

0 comments on commit 9c33445

Please sign in to comment.