mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 12:38:48 +03:00
Properly fix image uploads without image/* format
This commit is contained in:
parent
5734641778
commit
e52f90a941
1 changed files with 9 additions and 2 deletions
|
@ -155,9 +155,16 @@ InputBar::insertMimeData(const QMimeData *md)
|
||||||
if (md->hasImage()) {
|
if (md->hasImage()) {
|
||||||
if (formats.contains(QStringLiteral("image/svg+xml"), Qt::CaseInsensitive)) {
|
if (formats.contains(QStringLiteral("image/svg+xml"), Qt::CaseInsensitive)) {
|
||||||
startUploadFromMimeData(*md, QStringLiteral("image/svg+xml"));
|
startUploadFromMimeData(*md, QStringLiteral("image/svg+xml"));
|
||||||
} else if (formats.contains(QStringLiteral("image/png"), Qt::CaseInsensitive) ||
|
} else if (formats.contains(QStringLiteral("image/png"), Qt::CaseInsensitive)) {
|
||||||
formats.empty()) {
|
|
||||||
startUploadFromMimeData(*md, QStringLiteral("image/png"));
|
startUploadFromMimeData(*md, QStringLiteral("image/png"));
|
||||||
|
} else if (image.empty()) {
|
||||||
|
QByteArray ba;
|
||||||
|
QBuffer buffer(&ba);
|
||||||
|
buffer.open(QIODevice::WriteOnly);
|
||||||
|
qvariant_cast<QImage>(md->imageData()).save(&buffer, "PNG");
|
||||||
|
QMimeData d;
|
||||||
|
d.setData(QStringLiteral("image/png"), ba);
|
||||||
|
startUploadFromMimeData(d, image.first());
|
||||||
} else {
|
} else {
|
||||||
startUploadFromMimeData(*md, image.first());
|
startUploadFromMimeData(*md, image.first());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue