From c8d632389318bec2bd53d9c627e540cd3cdb3aaa Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 9 Sep 2022 00:18:23 +0200 Subject: Matrix: support pasting filepath with file:// for upload --- src/QuickMedia.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/QuickMedia.cpp') 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, ¤t_room](const std::string &filepath) { run_task_with_loading_screen([this, ¤t_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); -- cgit v1.2.3