diff -r 641dcc79e0ef -r 5de33c2d94c6 application/davcontroller.c --- a/application/davcontroller.c Sun Nov 10 15:30:46 2024 +0100 +++ b/application/davcontroller.c Mon Nov 11 20:45:34 2024 +0100 @@ -882,7 +882,7 @@ file->download->current_file_downloaded = 0; file->download->current_file_size = file->size; - FILE *f = fopen(file->to, "wb"); + FILE *f = sys_fopen(file->to, "wb"); if (!f) { return 0; } @@ -1299,7 +1299,7 @@ memset(rd, 0, 8); dav_rand_bytes(rd, 8); char *hex = util_hexstr(rd, 8); - cxmutstr tmp = cx_asprintf("%sdownload-%s-%s", dir, name, hex); + cxmutstr tmp = cx_asprintf("%sdownload-%s-%s", dir, hex, name); return tmp.ptr; } @@ -1322,7 +1322,7 @@ } } else if(doc->type == DAV_RESOURCE_VIEW_IMAGE) { char *tmp = gen_tmp_download_filename(res->name); - FILE *f = fopen(tmp, "w"); + FILE *f = sys_fopen(tmp, "wb"); if(f) { int err = dav_get_content(res, f, (dav_write_func)fwrite); if(!err) { @@ -1447,7 +1447,6 @@ ui_set(doc->text, doc->text_content->space); } else if(doc->type == DAV_RESOURCE_VIEW_IMAGE) { ui_image_load_file(doc->image, doc->tmp_file); - unlink(doc->tmp_file); } ui_set(doc->tabview, 1);