summaryrefslogtreecommitdiff
path: root/riscos/download.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-05-24 01:19:21 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-05-24 01:19:21 +0000
commit5979083a161d36013dadb8d13a569b99d4530352 (patch)
tree195b860bfb56b7a10ff28ad611db0458880d16a5 /riscos/download.c
parent2b79c34977e7254801ddee62dd096cb56bb2ee33 (diff)
downloadnetsurf-5979083a161d36013dadb8d13a569b99d4530352.tar.gz
netsurf-5979083a161d36013dadb8d13a569b99d4530352.tar.bz2
Unescape URL before attempting to read filetype
svn path=/trunk/netsurf/; revision=4195
Diffstat (limited to 'riscos/download.c')
-rw-r--r--riscos/download.c18
1 files 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 <string.h>
#include <sys/time.h>
#include <time.h>
+#include <curl/curl.h>
#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 */