cookbook icon indicating copy to clipboard operation
cookbook copied to clipboard

Can't parse recipe from JSON-LD with "

Open Orhideous opened this issue 3 years ago • 2 comments

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:

  1. Go to main page of cookbook
  2. Enter https://www.vkusnyblog.ru/recipe/myatnyj-limonad/ into «Download recipe from URL»
  3. Click on arrow
  4. 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

Orhideous avatar Jul 08 '22 19:07 Orhideous

See #1110

christianlupus avatar May 31 '24 08:05 christianlupus

This PR/issue depends on:

github-actions[bot] avatar May 31 '24 08:05 github-actions[bot]