diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2020-11-23 18:19:24 +0100 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2020-11-25 19:05:12 +0100 |
commit | c2eea5cb5508ce0ec090b84dc9a2c9fd25b4dd88 (patch) | |
tree | bb038209732705ed1fff2ec873038c34f6bfd956 | |
parent | Use a trie for filtering completions (not fuzzy yet) (diff) | |
download | nheko-c2eea5cb5508ce0ec090b84dc9a2c9fd25b4dd88.tar.xz |
Fix mimetype of media messages
-rw-r--r-- | src/dialogs/PreviewUploadOverlay.cpp | 8 | ||||
-rw-r--r-- | src/timeline/InputBar.cpp | 1 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/dialogs/PreviewUploadOverlay.cpp b/src/dialogs/PreviewUploadOverlay.cpp index e03993c7..bd207642 100644 --- a/src/dialogs/PreviewUploadOverlay.cpp +++ b/src/dialogs/PreviewUploadOverlay.cpp @@ -118,7 +118,7 @@ PreviewUploadOverlay::init() void PreviewUploadOverlay::setLabels(const QString &type, const QString &mime, uint64_t upload_size) { - if (mediaType_ == "image") { + if (mediaType_.split('/')[0] == "image") { if (!image_.loadFromData(data_)) { titleLabel_.setText(QString{tr(ERR_MSG)}.arg(type)); } else { @@ -154,7 +154,7 @@ PreviewUploadOverlay::setPreview(const QImage &src, const QString &mime) else titleLabel_.setText(QString{tr(ERR_MSG)}.arg(type)); - mediaType_ = split[0]; + mediaType_ = mime; filePath_ = "clipboard." + type; image_.convertFromImage(src); isImage_ = true; @@ -170,7 +170,7 @@ PreviewUploadOverlay::setPreview(const QByteArray data, const QString &mime) auto const &type = split[1]; data_ = data; - mediaType_ = split[0]; + mediaType_ = mime; filePath_ = "clipboard." + type; isImage_ = false; @@ -202,7 +202,7 @@ PreviewUploadOverlay::setPreview(const QString &path) auto const &split = mime.name().split('/'); - mediaType_ = split[0]; + mediaType_ = mime.name(); filePath_ = file.fileName(); isImage_ = false; diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp index 5c8f0f11..b0d555b7 100644 --- a/src/timeline/InputBar.cpp +++ b/src/timeline/InputBar.cpp @@ -511,6 +511,7 @@ InputBar::showPreview(const QMimeData &source, QString path, const QStringList & QSize dimensions; QString blurhash; auto mimeClass = mime.split("/")[0]; + nhlog::ui()->debug("Mime: {}", mime.toStdString()); if (mimeClass == "image") { QImage img = utils::readImage(&data); |