From 7f3c4d52fead36d78c36fd99e2c8b92d0838f2db Mon Sep 17 00:00:00 2001 From: dyknon Date: Sat, 17 Jan 2026 20:20:24 +0900 Subject: Consider all unknown mime types as application/octet-stream --- ytdlsb-main.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/ytdlsb-main.c b/ytdlsb-main.c index 8db1ad0..7b0c0f8 100644 --- a/ytdlsb-main.c +++ b/ytdlsb-main.c @@ -181,10 +181,11 @@ int ytdlsb_process_preload(struct ytdlsb_task *t){ CURLINFO_CONTENT_TYPE, &mtype)); if(respc == 200){ f->state = YTDLSB_SB_FAILED; - if(!mtype - || strcmp(mtype, "application/octet-stream") == 0 - || strcmp(mtype, "binary/octet-stream") == 0 - ){ + if(mtype && strcmp(mtype, "image/jpeg") == 0){ + f->state = YTDLSB_SB_JPEG; + }else if(mtype && strcmp(mtype, "image/webp") == 0){ + f->state = YTDLSB_SB_WEBP; + }else{ // twitch returns jpeg images in binary/octet-stream if(f->data && f->data_len >= 12){ if(memcmp(f->data, "\xff\xd8", 2) == 0){ @@ -196,10 +197,6 @@ int ytdlsb_process_preload(struct ytdlsb_task *t){ f->state = YTDLSB_SB_WEBP; } } - }else if(strcmp(mtype, "image/jpeg") == 0){ - f->state = YTDLSB_SB_JPEG; - }else if(strcmp(mtype, "image/webp") == 0){ - f->state = YTDLSB_SB_WEBP; } if(f->state == YTDLSB_SB_FAILED){ eprintf("invalid storyboard type: %s\n", mtype); -- cgit v1.2.3