diff options
author | Daniel Friesel <derf@finalrewind.org> | 2021-01-24 05:44:17 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2021-01-24 05:44:17 +0100 |
commit | 3ff5371635ae392034ad3905fa03e814dabda98e (patch) | |
tree | 0b94c1f5648e65e04415c5072d1270e84997e354 /src/filelist.c | |
parent | d72a19e7a3d58a4f9b314559378b17d4a6590c17 (diff) |
Handle URL-encoded components in "feh --start-at file://...."
Closes #584
Diffstat (limited to 'src/filelist.c')
-rw-r--r-- | src/filelist.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/filelist.c b/src/filelist.c index ae8d7b2..9d8b38a 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -28,6 +28,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <libexif/exif-data.h> #endif +#ifdef HAVE_LIBCURL +#include <curl/curl.h> +#endif + #include "feh.h" #include "filelist.h" #include "signals.h" @@ -678,3 +682,27 @@ void feh_save_filelist() free(tmpname); return; } + +#ifdef HAVE_LIBCURL + +char *feh_http_unescape(char *url) +{ + CURL *curl = curl_easy_init(); + if (!curl) { + return NULL; + } + char *tmp_url = curl_easy_unescape(curl, url, 0, NULL); + char *new_url = estrdup(tmp_url); + curl_free(tmp_url); + curl_easy_cleanup(curl); + return new_url; +} + +#else + +char *feh_http_unescape(char *url) +{ + return NULL; +} + +#endif |