From 5979083a161d36013dadb8d13a569b99d4530352 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sat, 24 May 2008 01:19:21 +0000 Subject: Unescape URL before attempting to read filetype svn path=/trunk/netsurf/; revision=4195 --- riscos/download.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/riscos/download.c b/riscos/download.c index fab09f41e..95da4f814 100644 --- a/riscos/download.c +++ b/riscos/download.c @@ -32,6 +32,7 @@ #include #include #include +#include #include "oslib/mimemap.h" #include "oslib/osargs.h" #include "oslib/osfile.h" @@ -250,7 +251,7 @@ struct gui_download_window *gui_download_window_create(const char *url, free(dw); return 0; } else if (res == URL_FUNC_OK) { - /* If we have a scheme and it's "file", then + /* If we have a scheme and it's "file", then * attempt to use the local filetype directly */ if (strcasecmp(scheme, "file") == 0) { char *path = NULL; @@ -261,7 +262,18 @@ struct gui_download_window *gui_download_window_create(const char *url, free(dw); return 0; } else if (res == URL_FUNC_OK) { - dw->file_type = ro_filetype_from_unix_path(path); + char *raw_path = curl_unescape(path, + strlen(path)); + if (raw_path == NULL) { + warn_user("NoMemory", 0); + free(path); + free(scheme); + free(dw); + return 0; + } + dw->file_type = + ro_filetype_from_unix_path(raw_path); + curl_free(raw_path); free(path); } } @@ -269,7 +281,7 @@ struct gui_download_window *gui_download_window_create(const char *url, free(scheme); } - /* If we still don't have a filetype (i.e. failed reading local + /* If we still don't have a filetype (i.e. failed reading local * one or fetching a remote object), then use the MIME type */ if (dw->file_type == 0) { /* convert MIME type to RISC OS file type */ -- cgit v1.2.3