diff options
Diffstat (limited to 'src/command/cmd_funcs.c')
-rw-r--r-- | src/command/cmd_funcs.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index f5535ad9..c50327be 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -9587,6 +9587,23 @@ cmd_url_open(ProfWin* window, const char* const command, gchar** args) #ifdef HAVE_OMEMO // OMEMO URLs (aesgcm://) must be saved and decrypted before being opened. if (g_strcmp0(scheme, "aesgcm") == 0) { + + // Ensure that the downloads directory exists for saving cleartexts. + gchar* downloads_dir = files_get_data_path(DIR_DOWNLOADS); + if (g_mkdir_with_parents(downloads_dir, S_IRWXU) != 0) { + cons_show_error("Failed to create download directory " + "at '%s' with error '%s'", + downloads_dir, strerror(errno)); + g_free(downloads_dir); + goto out; + } + + // Generate an unique filename from the URL that should be stored in the + // downloads directory. + //filename = unique_filename_from_url(url, downloads_dir); + filename = g_strdup_printf("%s/%s", downloads_dir, g_strsplit(g_basename(url), "#", 2)[0]); + g_free(downloads_dir); + // Download, decrypt and open the cleartext version of the AESGCM // encrypted file. _url_aesgcm_method(window, cmd_template, url, NULL); |