1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Remove "file://" from file names

Rationale: When copying an image in some application, a URL instead of a
path is copied to the clipboard.
This commit is contained in:
Maximilian Wuttke 2021-03-09 20:45:29 +01:00
parent a4ec8530a9
commit 1576ac11cb

View File

@ -577,6 +577,9 @@ get_expanded_path(const char* path)
GString* exp_path = g_string_new(""); GString* exp_path = g_string_new("");
gchar* result; gchar* result;
if (g_str_has_prefix(path, "file://")) {
path += strlen("file://");
}
if (strlen(path) >= 2 && path[0] == '~' && path[1] == '/') { if (strlen(path) >= 2 && path[0] == '~' && path[1] == '/') {
g_string_printf(exp_path, "%s/%s", getenv("HOME"), path + 2); g_string_printf(exp_path, "%s/%s", getenv("HOME"), path + 2);
} else { } else {