Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
[#1201](https://github.com/nextcloud/cookbook/pull/1201) @christianlupus
- Fix API endpoint helpers to enforce JSON answers and minor styling enhancements
[#1202](https://github.com/nextcloud/cookbook/pull/1202) @christianlupus
- Fix XPath to allow for microdata parsing with multiple adjacent schema objects in HTML code
[#1220](https://github.com/nextcloud/cookbook/pull/1220) @christianlupus

### Maintenance
- Use the pre-built database images for MySQL and PostgreSQL tests
Expand Down
2 changes: 1 addition & 1 deletion lib/Helper/HTMLParser/HttpMicrodataParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ private function searchSimpleProperties(DOMNode $recipeNode, string $property):
* @return DOMNodeList A list of all found child nodes with the given property
*/
private function searchChildEntries(DOMNode $recipeNode, string $prop): DOMNodeList {
return $this->xpath->query("//*[@itemprop='$prop']", $recipeNode);
return $this->xpath->query(".//*[@itemprop='$prop']", $recipeNode);
}

/**
Expand Down
4 changes: 4 additions & 0 deletions tests/Unit/Helper/HTMLParser/HttpMicrodataParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public function dataProvider(): array {
'caseC' => ['caseC.html',false,null],
'caseD' => ['caseD.html',true,'caseD.json'],
'caseE' => ['caseE.html',true,'caseE.json'],

'caseIssue1209' => ['caseFix1209.html',true,'caseFix1209.json'],
];
}

Expand All @@ -64,6 +66,8 @@ public function testHTMLFile($filename, $valid, $jsonFile): void {
$jsonDest = file_get_contents(__DIR__ . "/res_Microdata/$jsonFile");
$expected = json_decode($jsonDest, true);

// print_r(json_encode($res));

$this->assertTrue($valid);
$this->assertEquals($expected, $res);
} catch (HtmlParsingException $ex) {
Expand Down
Loading