Merge branch 'main' into prettier

This commit is contained in:
Tasia Iso 2024-02-23 09:50:49 +00:00
commit dbf5c7b832
2 changed files with 17 additions and 0 deletions

View File

@ -452,6 +452,12 @@ static void _file_stat_complete(uv_fs_t* request)
void tf_file_stat(tf_task_t* task, const char* path, void (*callback)(tf_task_t* task, const char* path, int result, const uv_stat_t* stat, void* user_data), void* user_data)
{
if (!path)
{
callback(task, path, -EINVAL, NULL, user_data);
return;
}
const char* zip = tf_task_get_zip_path(task);
size_t path_length = strlen(path) + 1;
stat_t* data = tf_malloc(sizeof(stat_t) + path_length);
@ -575,6 +581,12 @@ static void _file_read_after_work(uv_work_t* work, int result)
void tf_file_read(tf_task_t* task, const char* path, void (*callback)(tf_task_t* task, const char* path, int result, const void* data, void* user_data), void* user_data)
{
if (!path)
{
callback(task, path, -EINVAL, NULL, user_data);
return;
}
size_t path_length = strlen(path) + 1;
read_t* data = tf_malloc(sizeof(read_t) + path_length);
memset(data, 0, sizeof(read_t));

View File

@ -509,6 +509,11 @@ static void _httpd_endpoint_hitches(tf_http_request_t* request)
static const char* _after(const char* text, const char* prefix)
{
if (!text || !prefix)
{
return NULL;
}
size_t prefix_length = strlen(prefix);
if (strncmp(text, prefix, prefix_length) == 0)
{