mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
kdirshare: send 500 if icon pixmap saving fails
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
7f58ed303b
commit
f3515ca0b6
1 changed files with 8 additions and 4 deletions
|
@ -193,13 +193,17 @@ void KDirShareImpl::respond(const QByteArray &url, QByteArray *outdata, ushort *
|
|||
if (normalizedpath.startsWith(QLatin1String("/kdirshare_icons/"))) {
|
||||
const QPixmap iconpixmap = KIcon(normalizedpath.mid(17)).pixmap(20);
|
||||
QBuffer iconbuffer;
|
||||
iconbuffer.open(QBuffer::ReadWrite);
|
||||
iconbuffer.open(QBuffer::WriteOnly);
|
||||
if (!iconpixmap.save(&iconbuffer, "PNG")) {
|
||||
kWarning() << "Could not save image";
|
||||
outdata->append(s_data500);
|
||||
*outhttpstatus = 500;
|
||||
outheaders->insert("Content-Type", "text/html; charset=UTF-8");
|
||||
} else {
|
||||
outdata->append(iconbuffer.data());
|
||||
*outhttpstatus = 200;
|
||||
outheaders->insert("Content-Type", "image/png");
|
||||
}
|
||||
outdata->append(iconbuffer.data());
|
||||
*outhttpstatus = 200;
|
||||
outheaders->insert("Content-Type", "image/png");
|
||||
} else if (pathinfo.isDir()) {
|
||||
*outhttpstatus = 200;
|
||||
outheaders->insert("Content-Type", "text/html; charset=UTF-8");
|
||||
|
|
Loading…
Add table
Reference in a new issue