mirror of
https://framagit.org/veretcle/oolatoocs.git
synced 2025-07-20 20:41:17 +02:00
🐛: … was apposed to every link regardless of their length
This commit is contained in:
16
src/bsky.rs
16
src/bsky.rs
@@ -38,11 +38,13 @@ pub async fn build_post_record(
|
||||
|
||||
while let Some(found) = re.captures(&rt.text.clone()) {
|
||||
if let Some(group) = found.get(3) {
|
||||
rt.insert(group.start(), insert_chars);
|
||||
rt.delete(
|
||||
group.start() + insert_chars.len(),
|
||||
group.start() + insert_chars.len() + group.len(),
|
||||
);
|
||||
if !group.is_empty() {
|
||||
rt.insert(group.start(), insert_chars);
|
||||
rt.delete(
|
||||
group.start() + insert_chars.len(),
|
||||
group.start() + insert_chars.len() + group.len(),
|
||||
);
|
||||
}
|
||||
}
|
||||
if let Some(group) = found.get(1) {
|
||||
rt.delete(group.start(), group.start() + group.len());
|
||||
@@ -195,8 +197,8 @@ mod tests {
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_build_post_record() {
|
||||
let text = "@factornews@piaille.fr Retrouvez-nous ici https://www.nintendojo.fr/articles/editos/le-mod-renovation-de-8bitdo-pour-manette-n64 et là https://www.nintendojo.fr/articles/analyses/vite-vu/vite-vu-morbid-the-lords-of-ire";
|
||||
let expected_text = "@factornews@piaille.fr Retrouvez-nous ici www.nintendojo.fr/articles… et là www.nintendojo.fr/articles…";
|
||||
let text = "@factornews@piaille.fr Retrouvez-nous ici https://www.nintendojo.fr/articles/editos/le-mod-renovation-de-8bitdo-pour-manette-n64 et là https://www.nintendojo.fr/articles/analyses/vite-vu/vite-vu-morbid-the-lords-of-ire et un lien très court http://vsl.ie/TaMere";
|
||||
let expected_text = "@factornews@piaille.fr Retrouvez-nous ici www.nintendojo.fr/articles… et là www.nintendojo.fr/articles… et un lien très court vsl.ie/TaMere";
|
||||
|
||||
let bsky_conf = BlueskyConfig {
|
||||
handle: "tamerelol.bsky.social".to_string(),
|
||||
|
Reference in New Issue
Block a user