diff --git a/module/VuFind/src/VuFind/OAI/Server.php b/module/VuFind/src/VuFind/OAI/Server.php index e7a4c7bceea040bdf761e4417d08f2c255be5636..39cd81ae5bc4dc63577663d632c76a8472176874 100644 --- a/module/VuFind/src/VuFind/OAI/Server.php +++ b/module/VuFind/src/VuFind/OAI/Server.php @@ -312,6 +312,13 @@ class Server } } + // Headers should be returned only if the metadata format matching + // the supplied metadataPrefix is available. + // If RecordDriver returns nothing, skip this record. + if (empty($xml)) { + return true; + } + // Check for sets: $fields = $record->getRawData(); if (!is_null($this->setField) && !empty($fields[$this->setField])) { @@ -592,7 +599,7 @@ class Server $from, $until, $solrOffset, $solrLimit, $params['set'] ); $nonDeletedCount = $result->getResultTotal(); - $format = $verb == 'ListIdentifiers' ? false : $params['metadataPrefix']; + $format = $params['metadataPrefix']; foreach ($result->getResults() as $doc) { if (!$this->attachNonDeleted($xml, $doc, $format, $headersOnly)) { $this->unexpectedError('Cannot load document');