nextcloud / cookbook

🍲 A library for all your recipes
https://apps.nextcloud.com/apps/cookbook
GNU Affero General Public License v3.0
508 stars 87 forks source link

Can't parse recipe from JSON-LD with " #1077

Open Orhideous opened 2 years ago

Orhideous commented 2 years ago

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

christianlupus commented 1 month ago

See #1110

github-actions[bot] commented 1 month ago

This PR/issue depends on: