From a73b5973810ae8018856d645933164ccc3dc0ff3 Mon Sep 17 00:00:00 2001 From: jim Date: Wed, 22 Jul 2026 12:58:35 -0500 Subject: [PATCH] fix: strip only trailing numeric suffix from blog folder names NormalizeBlogFolderName removed "_1".."_9" as unanchored substrings, so a folder suffixed past a single digit lost the wrong characters: "_10" hit the "_1" rule and left the trailing "0" welded to the name, importing zomb-eh_10 as blog "zomb-eh0". That name does not exist on Tumblr, so every post imported under it 404s on --collect forever. Anchor the strip to a trailing _ instead. This also fixes blogs whose real name contains "_1" (some_1blog no longer becomes someblog) and folders suffixed "_0", which were not stripped at all. Verified against the live folder tree: zomb-eh_10 is the only existing folder whose normalized name changes. Co-Authored-By: Claude Opus 4.8 --- URLNotesGrabberCORE/Program.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/URLNotesGrabberCORE/Program.cs b/URLNotesGrabberCORE/Program.cs index 6dd96fc..389faa5 100644 --- a/URLNotesGrabberCORE/Program.cs +++ b/URLNotesGrabberCORE/Program.cs @@ -582,16 +582,11 @@ namespace URLNotesGrabberCORE protected static string NormalizeBlogFolderName(string folderName) { - return folderName - .Replace("_1", "") - .Replace("_2", "") - .Replace("_3", "") - .Replace("_4", "") - .Replace("_5", "") - .Replace("_6", "") - .Replace("_7", "") - .Replace("_8", "") - .Replace("_9", ""); + // Archive tools suffix duplicate blog folders with _1, _2, ... _10 and beyond. Strip only a + // trailing numeric suffix: unanchored substring removal ate the "_1" inside "_10" and left the + // "0" welded to the name (zomb-eh_10 -> zomb-eh0), and mangled any blog whose real name + // contains "_1". A blog name is never a prefix of itself plus "_", so this is safe. + return System.Text.RegularExpressions.Regex.Replace(folderName, @"_\d+$", ""); } static async Task FetchAndStoreReplyText(string blogName, long postID, long timestamp)