mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-23 23:09:39 +03:00
fix url to path on doze
svn path=/trunk/netsurf/; revision=10427
This commit is contained in:
parent
f81ea3419e
commit
9a95ad79d1
@ -57,6 +57,33 @@ char *path_to_url(const char *path)
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
char *url_to_path(const char *url)
|
||||
{
|
||||
char *url_path = curl_unescape(url, 0);
|
||||
char *path;
|
||||
char *sidx;
|
||||
|
||||
if ((url_path[FILE_SCHEME_PREFIX_LEN + 1] == ':') ||
|
||||
(url_path[FILE_SCHEME_PREFIX_LEN + 1] == '|')) {
|
||||
/* url_path contains a drive: prefix */
|
||||
path = strdup(url_path + FILE_SCHEME_PREFIX_LEN);
|
||||
|
||||
/* swap / for \ */
|
||||
sidx = strrchr(path, '/');
|
||||
while (sidx != NULL) {
|
||||
*sidx = '\\';
|
||||
sidx = strrchr(path, '/');
|
||||
}
|
||||
} else {
|
||||
/* return the absolute path including leading / */
|
||||
path = strdup(url_path + (FILE_SCHEME_PREFIX_LEN - 1));
|
||||
}
|
||||
curl_free(url_path);
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Locate a shared resource file by searching known places in order.
|
||||
*
|
||||
|
@ -46,11 +46,6 @@ bool cookies_update(const char *domain, const struct cookie_data *data)
|
||||
return true;
|
||||
}
|
||||
|
||||
char *url_to_path(const char *url)
|
||||
{
|
||||
return strdup(url + 5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the filename part of a full path
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user