A quoted word that isn't a file name; split parts with two digits
Test and deploy / test (push) Successful in 46s
Test and deploy / edge (push) Successful in 1m57s
Test and deploy / deploy (push) Successful in 1m41s

From the re-index's single-file releases:
- A quoted text without an extension ("My \"Official\" remaining set's
  of Inna … 025.jpg [25/74]", "… lr140x16.jpg ( file 046 of 922)
  \"yEnc\"", "\"Dr. Lust\" - … - [12/21] - Ed_DRL_VDR_LM.part09.rar") was
  the file name, the real one stayed in the subject: every file a release.
  It gives way to a file name with an extension beside it
  (nameBesideQuotes); random quoted names with none beside keep theirs.
- Split parts numbered with two digits ("Admiral.EP05.2008.720p.Rus.
  HDCLUB.mkv.21", a.b.movies.divx.russian) share their stem, as .001.
Both implementations; tests; fixtures identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daan MeijerandClaude Opus 5.5 committed 2026-10-11 23:46:43 +02:00
1 parent 625ea23171
commit 2814c77225
8 files changed
+77 -9

No files matched your search

+36 -1
View File
@@ -227,7 +227,7 @@ fn describe(subject: &str, name_end: Option<usize>, counter: &Counter, from: &st
_ => None,
};
let name = match quoted {
Some(name) => name,
Some(name) => name_beside_quotes(&name, &subject[..counter.index]).unwrap_or(name),
None => unquoted_name(&subject[..counter.index])?,
};
let name = name.as_str();
@@ -273,6 +273,28 @@ fn first_track(text: &str) -> Option<usize> {
None
}
/// nameBesideQuotes (lib/headers/subject.ts): a file name elsewhere when the quoted text has no extension.
pub fn name_beside_quotes(quoted: &str, before_counter: &str) -> Option<String> {
if has_extension(quoted) {
return None;
}
// .replace(/"[^"]*"/g, ' ')
let mut text = String::with_capacity(before_counter.len());
let mut rest = before_counter;
while let Some(open) = rest.find('"') {
match rest[open + 1..].find('"') {
Some(close) => {
text.push_str(&rest[..open]);
text.push(' ');
rest = &rest[open + 1 + close + 1..];
}
None => break,
}
}
text.push_str(rest);
unquoted_name(&text).filter(|n| has_extension(n))
}
/// unquotedName (lib/headers/subject.ts): the file name of a subject without a quoted one, from the text before its counter.
pub fn unquoted_name(before_counter: &str) -> Option<String> {
let mut text = before_counter.trim_end_matches(js::is_space);
@@ -896,4 +918,17 @@ mod unquoted_tests {
}
}
}
#[cfg(test)]
mod beside_quotes_tests {
use super::name_beside_quotes;
#[test]
fn a_name_beside_a_quoted_word() {
assert_eq!(name_beside_quotes("Official", "My \"Official\" remaining set's of Inna, Please help up to #69 if you can 025.jpg [25/74] - yEnc ").as_deref(), Some("025.jpg"));
assert_eq!(name_beside_quotes("Dr. Lust", "\"Dr. Lust\" - Lily Marlene, Vanessa Del Rio, Scorpio? - yEnc - [12/21] - Ed_DRL_VDR_LM.part09.rar ").as_deref(), Some("Ed_DRL_VDR_LM.part09.rar"));
assert_eq!(name_beside_quotes("1f0554e5fec14b8b05ca", "77cd6d03d19281a775f5bdc5 [2/8] - \"1f0554e5fec14b8b05ca\" yEnc ").as_deref(), None);
assert_eq!(name_beside_quotes("x.rar", "\"x.rar\" other.zip ").as_deref(), None);
}
}
}