Skip to content

Commit

Permalink
Indexer::createFile(): fixed top level directory recognition
Browse files Browse the repository at this point in the history
  • Loading branch information
zozlak committed Jan 12, 2022
1 parent 29c9b61 commit 767b093
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/acdhOeaw/arche/lib/ingest/Indexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ private function listFiles(SplFileInfo $dir, int $level): array {

private function createFile(SplFileInfo $file): File {
$path = $file->getPathname();
$dir = $file->getPath();
$schema = $this->repo->getSchema();

$id = self::pathToUtf8($path);
Expand All @@ -598,10 +599,10 @@ private function createFile(SplFileInfo $file): File {
$extMeta->addResource(RDF::RDF_TYPE, $this->binaryClass);
}
// parent
if (isset($this->parent) && ($this->flatStructure || $path === $this->directory)) {
if (isset($this->parent) && ($this->flatStructure || $dir === $this->directory)) {
$extMeta->addResource($schema->parent, $this->parent->getUri());
}
if ($path !== $this->directory && !$this->flatStructure) {
if ($dir !== $this->directory && !$this->flatStructure) {
$extMeta->addResource($schema->parent, substr($id, 0, strrpos($id, '/') ?: null));
}
// mime type and binary size
Expand Down

0 comments on commit 767b093

Please sign in to comment.