An image's post token needs a word in it, not only a size
Test and deploy / test (push) Successful in 46s
Test and deploy / edge (push) Successful in 2m1s
Test and deploy / deploy (push) Successful in 1m23s

"01of37 ## Alexi uses strange toys … ## alexis001.jpg (1/1) 57295b": with
the whole text as the name, the remainder is the file's size "57295b", which
229189f took for a post token: 16 sets of 36-37 images became 268 releases.
"MDG005b" has letters in a row; "57295b" doesn't.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daan MeijerandClaude Opus 5.5 committed 2026-10-13 10:33:52 +02:00
1 parent 652f278474
commit 3fd08b598a
3 files changed
+19 -2

No files matched your search

+9 -1
View File
@@ -845,7 +845,9 @@ pub fn release_identity(poster: &str, subject: &str, name: &str) -> Release {
let set = image_set(&stem);
let set = if set.is_empty() { name.clone() } else { set };
// Under a post token ("MDG005b - (01/90) "IMG_2307.JPG""): the post's too.
let key = if is_post_token(&remainder) { hash(&["stem", poster, &set, &remainder]) } else { hash(&["stem", poster, &set]) };
// A word in it, not a size ("… alexis001.jpg 57295b").
let post = is_post_token(&remainder) && remainder.as_bytes().windows(2).any(|w| w[0].is_ascii_alphabetic() && w[1].is_ascii_alphabetic());
let key = if post { hash(&["stem", poster, &set, &remainder]) } else { hash(&["stem", poster, &set]) };
return Release { key, name, source: "stem", file_total };
}
// An audiobook's or album's tracks without a name around them: by their name without its numbers.
@@ -1542,6 +1544,12 @@ mod image_set_tests {
let mdg = |post: &str, i: &str, n: &str| super::release_identity("p", &format!(r#"{post} - ({i}/90) "{n}" - 16,14 MB - yEnc"#), n);
assert_eq!(mdg("MDG005b", "01", "IMG_2307.JPG").key, mdg("MDG005b", "02", "IMG_2308.jpg").key);
assert_ne!(mdg("MDG005b", "01", "IMG_2307.JPG").key, mdg("MDG006a", "01", "IMG_4410.JPG").key);
// The whole text before "(1/1)" is the name; the size follows the segment counter.
let alexi = |i: &str, size: &str| {
let n = format!("{i}of37 ## Alexi uses strange toys to make herself come ## alexis0{i}.jpg");
super::release_identity("p", &format!("{n} {size}"), &n)
};
assert_eq!(alexi("01", "57295b").key, alexi("02", "32202b").key);
let milf = |i: &str, n: &str, kb: &str| super::release_identity("p", &format!("(Hot MILF getting banged hard)[{i}/70] - {n} - {kb}"), n);
assert_eq!(milf("27", "2407.jpg", "28").key, milf("28", "2408.jpg", "31").key);
assert_eq!(super::file_stem_re("rld-gtre.r13.002"), "rld-gtre");