Skip to content

Commit

Permalink
Fixed problem with edge case pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
YM162 committed Oct 6, 2024
1 parent c81b12e commit ae4fa02
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions gulagcleaner_rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ name = "gulagcleaner_rs"
[dependencies]
flate2 = "1.0.27"
lopdf = "0.34.0"
regex = "1.11.0"
Binary file not shown.
7 changes: 6 additions & 1 deletion gulagcleaner_rs/src/models/page_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,12 @@ fn is_annots_wuolah(annot: &&&lopdf::Dictionary, doc: &lopdf::Document) -> bool
Ok(x) => {
match doc.dereference(x).unwrap().1.as_dict().unwrap().get(b"URI") {
Ok(y) => {
doc.dereference(y).unwrap().1.as_string().unwrap().contains("track.wlh.es")
let url = doc.dereference(y).unwrap().1.as_string().unwrap();
if url.contains("track.wlh.es"){
return !(url.contains("apuntes"));
} else {
return false;
}
},
Err(_) => false,
}
Expand Down
8 changes: 8 additions & 0 deletions gulagcleaner_rs/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ fn test_041024_wuolah_pdf() {
});
}

#[test]
fn test_061024_wuolah_pdf() {
run_test_for_config(&TestConfig {
input_path: "example_docs/wuolah-061024-example.pdf",
output_filename: "wuolah-061024-example_clean.pdf",
});
}

#[test]
fn test_studocu_pdf() {
run_test_for_config(&TestConfig {
Expand Down

0 comments on commit ae4fa02

Please sign in to comment.