Use get_expanded_path() in cmd_senfile()

This commit is contained in:
Michael Vetter
2020-12-09 08:31:09 +01:00
parent a2291b36c4
commit 55f09b6152
2 changed files with 3 additions and 8 deletions

View File

@@ -4854,18 +4854,12 @@ gboolean
cmd_sendfile(ProfWin* window, const char* const command, gchar** args)
{
jabber_conn_status_t conn_status = connection_get_status();
char* filename = args[0];
gchar* filename;
char* alt_scheme = NULL;
char* alt_fragment = NULL;
// expand ~ to $HOME
if (filename[0] == '~' && filename[1] == '/') {
if (asprintf(&filename, "%s/%s", getenv("HOME"), filename + 2) == -1) {
return TRUE;
}
} else {
filename = strdup(filename);
}
filename = get_expanded_path(args[0]);
if (access(filename, R_OK) != 0) {
cons_show_error("Uploading '%s' failed: File not found!", filename);