aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-09-09 00:18:23 +0200
committerdec05eba <dec05eba@protonmail.com>2022-09-09 00:18:23 +0200
commitc8d632389318bec2bd53d9c627e540cd3cdb3aaa (patch)
treefb65ccf86c6115ddaefc4478e85c7ac3c0a60e90 /src
parentb677cfe8c261bae436d3e70a45256d79cfda28e3 (diff)
Matrix: support pasting filepath with file:// for upload
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 7cbe2c4..9f233da 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -5753,9 +5753,13 @@ namespace QuickMedia {
auto upload_file = [this, &current_room](const std::string &filepath) {
run_task_with_loading_screen([this, &current_room, filepath]() {
+ std::string filepath_mod = filepath;
+ if(string_starts_with(filepath_mod, "file://"))
+ filepath_mod.erase(filepath_mod.begin(), filepath_mod.begin() + 7);
+
std::string event_id_response;
std::string err_msg;
- if(matrix->post_file(current_room, filepath, event_id_response, err_msg) == PluginResult::OK) {
+ if(matrix->post_file(current_room, filepath_mod, event_id_response, err_msg) == PluginResult::OK) {
return true;
} else {
show_notification("QuickMedia", "Failed to upload media to room, error: " + err_msg, Urgency::CRITICAL);