leave very long file names to the maps instead of failing to lay them out
Signed-off-by: dawn <90008@klbr.net>
166 unmodified linesExpand all167168169170171172173171172173174175176177178179231 unmodified linesExpand all411412413414415416417418419420421422423424425426427428429430431432433434166 unmodified linesExpand all let named = kind.parse(key).and_then(|(commit, spelling, page)| { let path = match spelling { "" if kind.at_root() => Some(String::new()), _ => decode(spelling), } .filter(|path| path.split('/').all(|part| part.len() <= MAX_NAME_BYTES))?; Some((commit, kind.file(&path, page), path, spelling)) }?; let name = kind.file(&path, page); name.split('/') .all(|part| part.len() <= MAX_NAME_BYTES) .then_some((commit, name, path, spelling)) }); match named { Some((commit, name, path, spelling)) => { let group = groups.entry((commit, name)).or_insert_with(|| Group {231 unmodified linesExpand all format!("{generation_path}/{WWW}/$ks_git_commit"), format!("{DECODE}{}/$ks_git_commit/$arg_path", kind.name()), )}
#[cfg(test)]mod tests { use super::*;
#[test] fn a_page_suffix_counts_toward_the_name_limit() { let commit = "a".repeat(40); let cursor = "b".repeat(64); let fits = "x".repeat(MAX_NAME_BYTES - ",entry.json".len()); let mut rows = Rows::default(); rows.entry.insert(format!("{commit}|{fits}"), "e".into()); rows.log .insert(format!("{commit}|{fits}|100|{cursor}"), "l".into()); let (layout, unlaid) = split(&rows, false); let laid: Vec<&String> = layout.values().flat_map(|names| names.keys()).collect(); assert_eq!(laid, [&format!("{fits},entry.json")]); assert_eq!(unlaid.log.len(), 1); }}