FriendsOfShopware / FroshPlatformBunnycdnMediaStorage

This plugin allows you to use BunnyCDN as a media storage.
MIT License
8 stars 9 forks source link

Replace image file name issue #75

Closed carstenjaksch closed 9 months ago

carstenjaksch commented 9 months ago

PHP Version

8.2

Shopware Version

Tested on 6.5.8.6 and 6.5.8.2 (Staging)

Plugin Version

Tested on 3.3.3 and 3.1.2 (Staging)

Actual behaviour

Replacing an image with one that has a different file name doesn't work properly. The new image produces a 404.

This is the result in Shopware:

Bildschirm­foto 2024-02-29 um 11 39 23

Expected behaviour

I expect the new image to be uploaded and that the new URL works.

Steps to Reproduce?

  1. Upload an image via Content > Media
  2. Replace it with the same file, but a different filename.

@tinect I have tested that on our staging environment. The admin credentials still work. Search for "kante-test"

tinect commented 9 months ago

@carstenjaksch please fill the issue template, also for other users. :-) Shopware Version? Plugin Version?

Which plugins do you have installed?

carstenjaksch commented 9 months ago

@tinect Template updated!

Installed are the following plugins:

    "store.shopware.com/froshplatformbunnycdnmediastorage": "^3.1",
    "store.shopware.com/molliepayments": "^4.4",
    "store.shopware.com/neon6configurator": "^1.25",
    "store.shopware.com/neon6configuratordeliverytime": "^1.1",
    "store.shopware.com/neon6configuratorfileupload": "^1.0",
    "store.shopware.com/neon6configuratorinfo": "^1.0",
    "store.shopware.com/neon6configuratormedia": "^1.0",
    "store.shopware.com/newslettersendinblue": "^4.0",
    "store.shopware.com/swagcommercial": "^5.8",
    "store.shopware.com/swaglanguagepack": "^3.1",
    "store.shopware.com/zenitplatformgravity": "^3.7",
tinect commented 9 months ago

@carstenjaksch https://github.com/PlatformCommunity/flysystem-bunnycdn/issues/70

FYI. will try to fix it at this plugin and create a PR on the external project soon.

tinect commented 9 months ago

Fixed with 3.2.0

carstenjaksch commented 4 months ago

@tinect I updated to 3.3.1, the resulting 404 issue is gone and the file gets replaced on BunnyCDN.

However, the old file is still cached (perma-cache) and the URL displays the old file. I think the plugin is missing a purge request?

tinect commented 4 months ago

it is not missing, it is just not implement while it will blow up the plugin. additionally, it would not help, while the users browser has cached it, too. please also use the updatedAt-Parameter for the urla.

you use permacache for media? why? themes and assets gets new url, don‘t they?

carstenjaksch commented 4 months ago

@tinect Why would that blow up the plugin? It should be fairly simple, after a successful replace, to send the purge request with the file URL.

We use perma-cache because: It was enabled by default and I find it quite useful for things that don't change often – like media.

Theme and Asset files are set to local.

What do you mean with "please also use the updatedAt-Parameter for the url"?

tinect commented 4 months ago

you are using the storage of bunnycdn and activate the perma cache additionally? this is double caching in the same infrastructure.

„simple“ add? would you please create a PR doing this simple thing without effect of increasing the runtime and just affecting shopware 6.5?

Oh, sorry, I mixed information. updatedAt has been introduced in shopware 6.6. that would solve your problems automatically.

carstenjaksch commented 4 months ago

@tinect Please explain further, I am curious and this is not meant in a bad way: Why is a simple API request such a big deal?

Well I think perma-cache is active, but I can't find any option to disable or enable it. Or should I enable smart cache to disable perma-cache? And why would Bunny offer perma-cache for storage if this is a bad idea?

I can't find any information about the "updatedAt" url parameter in Shopware 6.6. Do you have a link with more info for me?

tinect commented 4 months ago

it is no big deal but would increase uploading times, complexity, etc…

the perma cache is meant for pull zones requesting the files from your shop, but not from the storage.

I‘m sorry, my free time is limited to assist people.

Shopware added a query string with a refactoring of media urls with mentioned version.

I recommend you someone who could add this feature in your project, if you need it.