Skip to content
Snippets Groups Projects
Commit 8c03d9ac authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Add helper to convert mxc urls

parent f4cc9554
No related branches found
No related tags found
No related merge requests found
Pipeline #2596 passed
......@@ -462,6 +462,7 @@ public:
const std::string &content_type,
const std::string &original_filename,
RequestErr err)> cb);
std::string mxc_to_download_url(const std::string &mxc_url);
//! Retrieve a thumbnail from the given mxc url.
//! If the thumbnail isn't found and `try_download` is `true` it will try
......
......@@ -687,6 +687,13 @@ Client::upload(const std::string &data,
api_path, data, std::move(cb), true, content_type);
}
std::string
mtx::http::Client::mxc_to_download_url(const std::string &mxc_url)
{
auto url = mtx::client::utils::parse_mxc_url(mxc_url);
return endpoint_to_url("/media/r0/download/" + url.server + "/" + url.media_id);
}
void
Client::download(const std::string &mxc_url,
std::function<void(const std::string &res,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment