Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cached metadata has empty data property #2831

Closed
tomhelmer opened this issue Nov 11, 2020 · 6 comments · Fixed by #2835
Closed

Cached metadata has empty data property #2831

tomhelmer opened this issue Nov 11, 2020 · 6 comments · Fixed by #2835

Comments

@tomhelmer
Copy link
Contributor

tomhelmer commented Nov 11, 2020

Bug Description

When asset metadata is fetched from the cache the data key is overwritten with an empty collection in:

if ($this->meta) {
    return array_merge($this->meta, ['data' => $this->data->all()]);
}

.. as $this->data isn't hydrated.

How to Reproduce

  • Add metadata to asset ( eg. alt text )
  • View asset and check that metadata is used
  • Reload page to get cached version and check metadata is gone

Extra Detail

Pull request

Environment

Statamic 3.0.26 Pro
Laravel 7.29.3
PHP 7.4.9

@timojokinen
Copy link
Contributor

thanks, i just bumped into this

@aerni
Copy link
Contributor

aerni commented Nov 11, 2020

Just run into this as well. Worked fine on Statamic 3.0.25.

@duncanmcclean
Copy link
Member

I can confirm this is a bug, likely related to the changes made in #2828.

@jesseleite
Copy link
Member

Should be fixed in 3.0.27, let us know if you have any issues going forward!

@delz-dev
Copy link

Broken again in 3.0.46? :-/ @jesseleite

.meta/B0002040_2.jpg.yaml

data:
  text: "Image description"
  alt: "Alt text"
size: 15246105

Antlers

{{ images }}
    <img src="{{ url }}" alt="{{ alt }}" />
{{ /images }}

Output

<img src="/img/B0002040_2.jpg" alt="">

@duncanmcclean
Copy link
Member

Broken again in 3.0.46? :-/ @jesseleite

.meta/B0002040_2.jpg.yaml

data:

  text: "Image description"

  alt: "Alt text"

size: 15246105

Antlers

{{ images }}

    <img src="{{ url }}" alt="{{ alt }}" />

{{ /images }}

Output

<img src="/img/B0002040_2.jpg" alt="">

Hey! If it's broken again, would you mind opening a fresh issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants