mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-26 16:29:36 +03:00
Ensure the file that is read for info is in the platform's native path format, whilst
the path used for any links is in the correct URL format. svn path=/trunk/netsurf/; revision=10761
This commit is contained in:
parent
883c738c0a
commit
4972283771
@ -369,6 +369,7 @@ static void fetch_file_process_dir(struct fetch_file_context *ctx,
|
||||
char *title; /* pretty printed title */
|
||||
url_func_result res; /* result from url routines */
|
||||
char *up; /* url of parent */
|
||||
char *path; /* url for list entries */
|
||||
bool compare; /* result of url compare */
|
||||
|
||||
DIR *scandir; /* handle for enumerating the directory */
|
||||
@ -433,12 +434,9 @@ static void fetch_file_process_dir(struct fetch_file_context *ctx,
|
||||
if (ent->d_name[0] == '.')
|
||||
continue;
|
||||
|
||||
snprintf(urlpath,
|
||||
sizeof urlpath,
|
||||
"%s%s%s",
|
||||
ctx->path,
|
||||
(ctx->path[strlen(ctx->path) - 1] == '/')?"":"/" ,
|
||||
ent->d_name);
|
||||
strncpy(urlpath, ctx->path, sizeof urlpath);
|
||||
if (path_add_part(urlpath, sizeof urlpath, ent->d_name) == false)
|
||||
continue;
|
||||
|
||||
if (stat(urlpath, &ent_stat) != 0) {
|
||||
ent_stat.st_mode = 0;
|
||||
@ -460,11 +458,14 @@ static void fetch_file_process_dir(struct fetch_file_context *ctx,
|
||||
}
|
||||
}
|
||||
|
||||
if((path = path_to_url(urlpath)) == NULL)
|
||||
continue;
|
||||
|
||||
if (S_ISREG(ent_stat.st_mode)) {
|
||||
/* regular file */
|
||||
dirlist_generate_row(even,
|
||||
false,
|
||||
urlpath,
|
||||
path,
|
||||
ent->d_name,
|
||||
fetch_filetype(urlpath),
|
||||
ent_stat.st_size,
|
||||
@ -474,7 +475,7 @@ static void fetch_file_process_dir(struct fetch_file_context *ctx,
|
||||
/* directory */
|
||||
dirlist_generate_row(even,
|
||||
true,
|
||||
urlpath,
|
||||
path,
|
||||
ent->d_name,
|
||||
messages_get("FileDirectory"),
|
||||
-1,
|
||||
@ -484,7 +485,7 @@ static void fetch_file_process_dir(struct fetch_file_context *ctx,
|
||||
/* something else */
|
||||
dirlist_generate_row(even,
|
||||
false,
|
||||
urlpath,
|
||||
path,
|
||||
ent->d_name,
|
||||
"",
|
||||
-1,
|
||||
@ -492,6 +493,8 @@ static void fetch_file_process_dir(struct fetch_file_context *ctx,
|
||||
buffer, sizeof(buffer));
|
||||
}
|
||||
|
||||
free(path);
|
||||
|
||||
if (fetch_file_send_callback(FETCH_DATA, ctx,
|
||||
buffer,
|
||||
strlen(buffer),
|
||||
|
Loading…
Reference in New Issue
Block a user