Skip to content

Commit e9c5cd4

Browse files
Fix poppler test failure
1 parent c6916e3 commit e9c5cd4

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

src/adapters/custom.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ mod test {
221221

222222
#[test]
223223
fn poppler() -> Result<()> {
224+
let _ = env_logger::try_init();
224225
let adapter = builtin_spawning_adapters
225226
.iter()
226227
.find(|e| e.name == "poppler")
@@ -231,7 +232,7 @@ mod test {
231232
let filepath = test_data_dir().join("short.pdf");
232233

233234
let (a, d) = simple_adapt_info(&filepath, Box::new(File::open(&filepath)?));
234-
let mut r = adapter.adapt(a, &d)?;
235+
let r = adapter.adapt(a, &d)?;
235236
let o = adapted_to_vec(r)?;
236237
assert_eq!(
237238
String::from_utf8(o)?,

src/adapters/email.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{cell::RefCell, io::Cursor};
22

33
use super::*;
4-
use crate::{adapted_iter::AdaptedFilesIter};
4+
use crate::adapted_iter::AdaptedFilesIter;
55
use anyhow::*;
66
use lazy_static::lazy_static;
77
use log::*;
@@ -14,7 +14,9 @@ lazy_static! {
1414
static ref METADATA: AdapterMeta = AdapterMeta {
1515
name: "email".to_owned(),
1616
version: 1,
17-
description: "Reads an email file into a buffer and runs a different extractor on the contents".to_owned(),
17+
description:
18+
"Reads an email file into a buffer and runs a different extractor on the contents"
19+
.to_owned(),
1820
recurses: true,
1921
fast_matchers: EXTENSIONS
2022
.iter()
@@ -89,7 +91,7 @@ impl<'a> AdaptedFilesIter<'a> for EmailAdaptIter<'a> {
8991
postprocess,
9092
config: self.inp.config.clone(),
9193
})
92-
}}
94+
}};
9395
}
9496
if self.buf_parts.is_none() {
9597
let mut buf = Vec::new();

src/adapters/spawning.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl FileAdapter for SpawningFileAdapter {
165165
debug!("executing {:?}", cmd);
166166
let output = pipe_output(&line_prefix, cmd, &mut inp, self.inner.get_exe(), "")?;
167167
Ok(Box::new(SingleAdaptedFileAsIter::new(AdaptInfo {
168-
filepath_hint,
168+
filepath_hint: filepath_hint.join("adapted"), // stop infinite recursion based on extension
169169
inp: output,
170170
line_prefix,
171171
is_real_file: false,

src/preproc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ fn run_adapter<'a>(
223223
.adapt(
224224
AdaptInfo {
225225
line_prefix,
226-
filepath_hint: filepath_hint.join("xx"), // FIXME: this is just a hack to make the PDF extractor work
226+
filepath_hint: filepath_hint.clone(),
227227
is_real_file,
228228
inp,
229229
archive_recursion_depth,

0 commit comments

Comments
 (0)