Prevent directory creation on bogus thumbnail downloads (#15634)

This commit is contained in:
sonninnos 2023-08-22 09:07:38 +03:00 committed by GitHub
parent 785ff20437
commit 5533f3881f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -243,6 +243,13 @@ void cb_http_task_download_pl_thumbnail(
if (!data || !data->data || string_is_empty(transf->path))
goto finish;
/* Skip if data can't be good */
if (data->status != 200)
{
err = "File not found.";
goto finish;
}
/* Create output directory, if required */
strlcpy(output_dir, transf->path, sizeof(output_dir));
path_basedir_wrapper(output_dir);
@ -253,13 +260,6 @@ void cb_http_task_download_pl_thumbnail(
goto finish;
}
/* Skip if data can't be good */
if (data->status != 200)
{
err = "File not found.";
goto finish;
}
/* Write thumbnail file to disk */
if (!filestream_write_file(transf->path, data->data, data->len))
{