From 47884d71ad16c44a4dbbbc98cf58edd0879cdc55 Mon Sep 17 00:00:00 2001 From: Mark Jordan Date: Mon, 16 Apr 2018 13:34:03 -0700 Subject: [PATCH] Work on #466. --- src/filegetters/CsvBooks.php | 6 +++++- src/filegetters/CsvNewspapers.php | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/filegetters/CsvBooks.php b/src/filegetters/CsvBooks.php index eed78cd..9120fc8 100644 --- a/src/filegetters/CsvBooks.php +++ b/src/filegetters/CsvBooks.php @@ -37,10 +37,14 @@ public function __construct($settings) */ public function getChildren($record_key) { + $item_info = $this->fetcher->getItemInfo($record_key); + $book_directory = $item_info->{$this->file_name_field}; + $page_paths = array(); $book_input_path = $this->getBookSourcePath($record_key); foreach ($this->OBJFilePaths as $path) { - if (strpos($path, $book_input_path) === 0) { + $current_book_dirname = dirname($path); + if ($current_book_dirname === $this->input_directory . DIRECTORY_SEPARATOR . $book_directory) { $page_paths[] = $path; } } diff --git a/src/filegetters/CsvNewspapers.php b/src/filegetters/CsvNewspapers.php index 30f95ba..28a6b6f 100644 --- a/src/filegetters/CsvNewspapers.php +++ b/src/filegetters/CsvNewspapers.php @@ -39,12 +39,15 @@ public function __construct($settings) */ public function getChildren($record_key) { + $item_info = $this->fetcher->getItemInfo($record_key); + $issue_directory = $item_info->{$this->file_name_field}; + $page_paths = array(); $issue_input_path = $this->getIssueSourcePath($record_key); foreach ($this->OBJFilePaths as $paths) { foreach ($paths as $path) { - // If there's a match, we expect it to start at position 0. - if (strpos($path, $issue_input_path) === 0) { + $current_issue_dirname = dirname($path); + if ($current_issue_dirname === $this->input_directory . DIRECTORY_SEPARATOR . $issue_directory) { $page_paths[] = $path; } }