diff options
author | Patrick Steinhardt <ps@pks.im> | 2022-12-21 15:45:58 +0100 |
---|---|---|
committer | Rafael Marçalo <raroma09@gmail.com> | 2023-01-03 15:09:04 +0000 |
commit | 6ed49e8e6c622053bca41db297c5f2647097dd74 (patch) | |
tree | e7fb85e0e938cebe5b6f9b065caf502a88ca3857 /src/main.c | |
parent | de6a197bf500e9e329e21e7209cc8764ec4456e5 (diff) |
global: Convert use of `SoupURI` to use `GUri`
The `SoupURI` interface has been deprecated in libsoup 3.0 in favor of
`GUri`, which is part of glib 2.66 and newer. Convert the codebase to
use the latter.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -131,19 +131,25 @@ struct neovimb vb; gboolean vb_download_set_destination(Client *c, WebKitDownload *download, char *suggested_filename, const char *path) { - char *download_path, *dir, *file, *uri, *basename = NULL, - *decoded_uri = NULL; - const char *download_uri; + char *download_path, *dir, *file, *uri, *basename = NULL; + download_path = GET_CHAR(c, "download-path"); if (!suggested_filename || !*suggested_filename) { + const char *download_uri; + GUri *parsed_uri = NULL; + char *decoded_uri; + /* Try to find a matching name if there is no suggested filename. */ download_uri = webkit_uri_request_get_uri(webkit_download_get_request(download)); - decoded_uri = soup_uri_decode(download_uri); + parsed_uri = g_uri_parse(download_uri, G_URI_FLAGS_NONE, NULL); + decoded_uri = g_uri_to_string(parsed_uri); basename = g_filename_display_basename(decoded_uri); - g_free(decoded_uri); suggested_filename = basename; + + g_uri_unref(parsed_uri); + g_free(decoded_uri); } /* Prepare the path to save the download. */ |