2022-11-09 Fred Gleason <fredg@paravelsystems.com>

* Added a file format check to the 'Image Manager' dialog in
	rdadmin(1) to ensure that only JPEG or PNG formatted image files can
	be imported.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2022-11-09 11:07:57 -05:00
parent db6879d6a8
commit 0c139bf849
4 changed files with 45 additions and 0 deletions

View File

@@ -713,6 +713,19 @@ int RDFeed::importImageFile(const QString &pathname,QString *err_msg,
QSize max=rda->rssSchemas()->maximumImageSize(rssSchema());
*err_msg="OK";
//
// Check the file type
//
QString mimetype=RDMimeType(pathname,&ok);
if(!ok) {
*err_msg=tr("Error validating image file.");
return -1;
}
if((mimetype!="image/jpeg")&&(mimetype!="image/png")) {
*err_msg=tr("Unsupported image file format.");
return -1;
}
//
// Load the image
//