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)