Part-DB / Part-DB-server

Part-DB is an Open source inventory management system for your electronic components
https://docs.part-db.de/
GNU Affero General Public License v3.0
928 stars 107 forks source link

Label twig-mode: data_uri filter not found #665

Closed codeaddicted closed 2 months ago

codeaddicted commented 3 months ago

Describe the bug when trying to create a label with twig-mode enabled i am unable to inline the generated barcode_svg result because of the missing data_uri plugin. the generated error is Unknown "data_uri" filter in "lines" at line 1.. what am i doing wrong here?

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Tools' -> 'Labeldialog'
  2. Enable Twig mode on 'Advanced'
  3. Enter any Target ID of existing part
  4. enter Content: {{ barcode_svg("test", "QRCODE") | data_uri }}
  5. Press 'Update'
  6. See Error Unknown "data_uri" filter in "lines" at line 1.

Expected behavior A label should be generated which outputs the data url generated by the given twig commands.

Screenshots Bildschirmfoto_2024-08-04_16-30-28

Server Side

Desktop (please complete the following information):

Additional context Partdb is freshly installed today (using: https://docs.part-db.de/installation/installation_guide-debian.html) no errors during installation. Using data_uri(mime="image/svg+xml") does not work either.

jbtronics commented 2 months ago

The twig extension required for the data_uri filter was not loaded into the sandboxed twig, and therfore was not available.

This is now fixed with the latest commit.

Thanks.