summaryrefslogtreecommitdiff
path: root/src/filelist.c
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-01-24 05:44:17 +0100
committerDaniel Friesel <derf@finalrewind.org>2021-01-25 17:45:47 +0100
commit9ba35b0c7f82d49158accba691964b3d26290cbd (patch)
tree63d1e0d6e5bba4e8eb8085ce2327e5ad9a7bfa8f /src/filelist.c
parent9353845a5f397a36440263800d9a70a80ab609ad (diff)
Handle URL-encoded components in "feh --start-at file://...."
Closes #584
Diffstat (limited to 'src/filelist.c')
-rw-r--r--src/filelist.c28
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