Skip to content

Commit

Permalink
feat: fix file upload on android
Browse files Browse the repository at this point in the history
  • Loading branch information
pontaoski committed Feb 3, 2022
1 parent 6e95792 commit d575312
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/stores/uploading.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ inline Croutons::FutureResult<QString> uploadFile(State* state, QString host, QU
{
QHttpMultiPart *mp = new QHttpMultiPart(QHttpMultiPart::FormDataType);

QFile* file(new QFile(url.toLocalFile()));
const auto furl = url.isLocalFile() ? url.toLocalFile() : url.toString();
QFile* file(new QFile(furl));
file->open(QIODevice::ReadOnly);

const auto fname = QString::fromLocal8Bit(QUrl::toPercentEncoding(url.fileName()));
Expand All @@ -34,7 +35,7 @@ inline Croutons::FutureResult<QString> uploadFile(State* state, QString host, QU

QUrlQuery query;
query.addQueryItem("filename", url.fileName());
query.addQueryItem("contentType", QMimeDatabase().mimeTypeForFile(url.toLocalFile()).name());
query.addQueryItem("contentType", QMimeDatabase().mimeTypeForFile(furl).name());

auto c = co_await state->api()->clientForHomeserver(host);

Expand Down

0 comments on commit d575312

Please sign in to comment.