fixed cache system for percentage encoded file in single-file mode

This commit is contained in:
Fufu Fang 2024-05-05 23:35:08 +01:00
parent 28293b5ccd
commit 720db5aafa
No known key found for this signature in database
GPG Key ID: 8A4CB08B0A7E27CE
3 changed files with 3 additions and 8 deletions

View File

@ -670,9 +670,7 @@ int Cache_create(const char *path)
Link *this_link = path_to_Link(path);
char *fn = "__UNINITIALISED__";
/*
* TODO: Warning: curl_easy_unescape breaks cache creation
*/
if (CONFIG.mode == NORMAL) {
fn = curl_easy_unescape(NULL,
this_link->f_url + ROOT_LINK_OFFSET, 0,

View File

@ -116,10 +116,6 @@ static int fs_open(const char *path, struct fuse_file_info *fi)
/*
* The cache definitely cannot be opened for some reason.
*/
/*
* TODO: This appears to be broken when the file needs to be
* percentage encoded
*/
if (!fi->fh) {
lprintf(fatal, "Cache file creation failure for %s.\n", path);
return -ENOENT;

View File

@ -263,7 +263,8 @@ static void LinkTable_uninitialised_fill(LinkTable *linktbl)
*/
static LinkTable *single_LinkTable_new(const char *url)
{
char *ptr = strrchr(url, '/') + 1;
char *orig_ptr = strrchr(url, '/') + 1;
char *ptr = curl_easy_unescape(NULL, orig_ptr, 0, NULL);
LinkTable *linktbl = LinkTable_alloc(url);
Link *link = Link_new(ptr, LINK_UNINITIALISED_FILE);
strncpy(link->f_url, url, MAX_FILENAME_LEN);