statamic / v2-hub

Statamic 2 - Feature Requests and Bug Reports
https://statamic.com
95 stars 5 forks source link

Asset preview does not work within partial with Symfony Yaml Parser #1998

Open efoken opened 6 years ago

efoken commented 6 years ago

Describe the bug We different fieldsets including the default fieldset as a partial. But if we do switch the Yaml parser to Symfony, the preview of asset fields does not work anymore – see screenshots.

To Reproduce

  1. Create two fieldsets. We have default.yaml and award.yaml.
title: Default
fields:
  header_image:
    type: assets
    display: 'Header Image'
    container: main
    folder: images
    restrict: false
    max_files: 1
title: Award
fields:
  title:
    type: text
    display: Title
    localizable: true
  template:
    type: hidden
    display: Template
    default: award
  award:
    type: suggest
    display: Award
    mode: IfDesignAward
    max_items: 1
    create: false
  long_form:
    type: partial
    display: 'Long Form Content'
    fieldset: default
  1. Create a page using the award fieldset.
  2. Upload a header image.
  3. Switch the Yaml parser in system.yaml to symfony

Expected behavior Preview should appear.

Screenshots Without Symfony Yaml:

bildschirmfoto 2018-06-03 um 16 49 49

and with:

bildschirmfoto 2018-06-03 um 16 49 36

Environment details (please complete the following information):

jasonvarga commented 6 years ago

Seems fine to me, but I had to remove the award field because I don't have your fieldtype.

Does it work if you remove the award field?

efoken commented 6 years ago

Ah seems to be something with too long filenames.

Before:

header_image: >
  /assets/world-design-guide/our-awards/professional-awards/taipei-cycle-di-awards-2018/benefits/benefit-detailseite/tpc-benefit-detail-logo.jpg

With Symfony Yaml, deleted and re-selected the asset:

header_image: /assets/world-design-guide/our-awards/professional-awards/taipei-cycle-di-awards-2018/benefits/benefit-detailseite/tpc-benefit-detail-logo.jpg

I found out that longs strings previously saved using a > are outputted with a linebreak at the end after switching to the Symfony Yaml parser – and that's the issue why the preview does not work anymore.