nextcloud / nextcloud/cookbook
Can't parse recipe from JSON-LD with "
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 641
- Forks
- 113
- Avg merge
- 21h 31m
- Merged PRs (30d)
- 26
Description
Description
Due to too eager HtmlEntityDecodeFilter behavior recipes, containing " somewhere cannot be added from URL, because it converts " to " and brokes resulting JSON.
Reproduction
Steps to reproduce the behavior:
- Go to main page of cookbook
- Enter https://www.vkusnyblog.ru/recipe/myatnyj-limonad/ into «Download recipe from URL»
- Click on arrow
- See parsing error
Expected behavior
Recipe should be added
Actual behavior
Instead of recipe error appears
As workaround I propose to add ENT_NOQUOTES flag to HtmlEntityDecodeFilter, like this:
class HtmlEntityDecodeFilter extends AbstractHtmlFilter {
public function apply(string &$html): void {
$html = html_entity_decode($html, ENT_NOQUOTES);
}
}
More correct fix will require some refactoring: IMHO, this filter should be applied only to all text fields in recipe instead of applying to raw data.
Depends on #1110
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the HtmlEntityDecodeFilter class and the URL recipe-import path described in the reproduction. Use the provided vkusnyblog.ru URL to reproduce the JSON-LD parsing error, then verify that recipes containing " are imported successfully without breaking the JSON; consider the dependency on #1110 before proceeding.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100