getkirby / getkirby.com

Source code and content for the Kirby website
https://getkirby.com
125 stars 260 forks source link

[Cookbook] “Protecting files” recipe doesn’t seem to work with 4.2.0 #2301

Closed elyukai closed 2 months ago

elyukai commented 2 months ago

Hi,

I hope this is the right place to address this. I previously asked on Discord, but this might just be the better place to discuss that.

I tried following along Protecting files, but I’m stuck at file::url component. The URL is correct, but the file is still copied to the media folder and it’s also being redirected to.

I stepped into the code and could identify Kirby\Cms\App:792 as the cause for the redirects. Did anything change in V4 in that regard? I figured out that the line was already present in V3, though.

I tried to reproduce the issue just with the plainkit and the issue persists. I only added the minimum index.php plugin contents and an example file to test with. I attached the changed plainkit, if that helps identifying the issue.

Maybe there’s something missing to make this work in V4?

texnixe commented 2 months ago

I think it still works as expected, but will double-check tonight. The official place to ask for support would be our support forum: https://forum.getkirby.com.

elyukai commented 2 months ago

Oh, I'm sorry about the misplacement. 😬 I'll put it there first next time.

And thank you for looking into it! 🙌🏻☺️

texnixe commented 2 months ago

Sorry for the delay, I tested the recipe again, and it works for me as expected. Your plainkit example only has the file url component but lacks all the rest described in the recipe, in particular the route which is crucial for this to work.

elyukai commented 1 month ago

No worries, thanks for looking into it! 🙌🏻

Oh, okay, I was assuming that it wouldn't create a file already after just extending the file::url component, since that's how I read this paragraph from that section:

If you delete the media folder now, and click on the file links again, you will see that this time no file copies will be generated anymore.

It does not mention that I need to follow the rest of the recipe for this to happen, so I assumed this would partially work as described there. Since in the next paragraph it also mentioned that I need a route, but only to hide the files from their standard URL.