Page MenuHomePhorge

D104.1732569256.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D104.1732569256.diff

diff --git a/src/contents/ui/KazvIOMenu.qml b/src/contents/ui/KazvIOMenu.qml
--- a/src/contents/ui/KazvIOMenu.qml
+++ b/src/contents/ui/KazvIOMenu.qml
@@ -57,6 +57,7 @@
[MK.KazvIOBaseJob.WriteFileError, 'kazv-io-failure-detail-write-file-error'],
[MK.KazvIOBaseJob.KIOError, 'kazv-io-failure-detail-network-error'],
[MK.KazvIOBaseJob.HashError, 'kazv-io-failure-detail-hash-error'],
+ [MK.KazvIOBaseJob.ResponseError, 'kazv-io-failure-detail-response-error'],
[MK.KazvIOBaseJob.KazvError, 'kazv-io-failure-detail-kazv-error']
])
resultMsg.text = l10n.get(resultL10nId, {detail: l10n.get(detailL10nId.get(ec))})
diff --git a/src/kazv-io-job.hpp b/src/kazv-io-job.hpp
--- a/src/kazv-io-job.hpp
+++ b/src/kazv-io-job.hpp
@@ -58,6 +58,11 @@
* Error caused by hash error
*/
HashError,
+ /**
+ * Error caused by invalid response.
+ * KIO reported no error, but got an invalid JSON response.
+ */
+ ResponseError,
/**
* Errors caused by bad code, means the bug is somewhere.
*/
diff --git a/src/kazv-io-job.cpp b/src/kazv-io-job.cpp
--- a/src/kazv-io-job.cpp
+++ b/src/kazv-io-job.cpp
@@ -295,7 +295,11 @@
return;
}
- auto j = nlohmann::json::parse(m_d->response.toStdString());
+ auto j = nlohmann::json::parse(m_d->response.toStdString(), nullptr, false);
+ if (j.is_discarded()) {
+ emitResult(ResponseError);
+ return;
+ }
auto mxcUri = QString::fromStdString(j["content_uri"].get<std::string>());
auto shouldSendMessage = !!m_d->room;
diff --git a/src/l10n/en/100-ui.ftl b/src/l10n/en/100-ui.ftl
--- a/src/l10n/en/100-ui.ftl
+++ b/src/l10n/en/100-ui.ftl
@@ -209,6 +209,7 @@
kazv-io-failure-detail-open-file-error = Open file error
kazv-io-failure-detail-write-file-error = Write file error
kazv-io-failure-detail-hash-error = Hash check error
+kazv-io-failure-detail-response-error = Get an invalid response
kazv-io-failure-detail-kazv-error = Unknow Error, please report this as bug.
kazv-io-upload-failure-prompt = Upload failure: { $detail }
kazv-io-downloading-prompt = Downloading: { $fileName }

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 1:14 PM (11 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40320
Default Alt Text
D104.1732569256.diff (2 KB)

Event Timeline