From afba2c0f85eb33ac342cb0388dd8bc794daaedab Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Sun, 25 Jan 2026 19:03:56 -0500 Subject: [PATCH] corrected false positive in abnormal patreon sources. --- backend/app/services/gallery_dl.py | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/backend/app/services/gallery_dl.py b/backend/app/services/gallery_dl.py index 7bac65c..861b833 100644 --- a/backend/app/services/gallery_dl.py +++ b/backend/app/services/gallery_dl.py @@ -305,7 +305,29 @@ class GalleryDLService: """Categorize the error based on output and return code.""" combined = f"{stdout} {stderr}".lower() - if "401" in combined or "unauthorized" in combined or "login" in combined: + # Check for "no new content" first - skipped files with return code 1 is normal + if return_code == 1: + # Check if output indicates content was processed (skipped = already downloaded) + if "skipping" in combined or "skip" in combined: + return ErrorType.NO_NEW_CONTENT, "No new content to download" + # Empty output with return code 1 often means nothing to download + if not stdout.strip() or "no results" in combined: + return ErrorType.NO_NEW_CONTENT, "No new content to download" + + # Auth errors - be more specific to avoid false positives from debug URLs + # Look for actual error messages, not just keywords that appear in URLs + auth_patterns = [ + "401", + "unauthorized", + "login required", + "please login", + "must be logged in", + "authentication required", + "session expired", + "invalid cookie", + "cookies are expired", + ] + if any(pattern in combined for pattern in auth_patterns): return ErrorType.AUTH_ERROR, "Authentication failed - cookies may be expired or invalid" if "429" in combined or "rate limit" in combined or "too many requests" in combined: @@ -320,9 +342,6 @@ class GalleryDLService: if "403" in combined or "forbidden" in combined or "access denied" in combined: return ErrorType.ACCESS_DENIED, "Access denied - may need higher subscription tier" - if return_code == 1 and ("no" in combined or "skip" in combined or not stdout.strip()): - return ErrorType.NO_NEW_CONTENT, "No new content to download" - if "http error" in combined: return ErrorType.HTTP_ERROR, "HTTP error occurred"