Closed thisisfuller closed 2 years ago
The new previewUrl()
method with 3.6 only uses the file::url
component if preview is disabled or page is draft. Otherwise the link is the local file source.
https://github.com/getkirby/kirby/blob/3.6.2/src/Cms/File.php#L755
I think the main idea here was that the URL in the Panel should point to the actual file, e.g. in content
, and not to the media thumb. But maybe we need an additional check whether a custom file::url
component was configured. In that case, always use it no matter what.
@distantnative Thanks, Just to add, it's important when you're trying to make a firewall / secure area for files that shouldn't have any public access.
@thisisfuller I hear you but wondering why this would be the case for something displayed in the Panel, which isn't public access already.
@distantnative Because by default the panel makes media files for the previews / files in the panel, which in turn could potentially be accessed publicly.
But maybe we need an additional check whether a custom file::url component was configured. In that case, always use it no matter what.
@distantnative I like the simple idea but guess we haven't custom/overridden component checker. We can list native components but can't know which ones overridden. Do you have an idea how about checking overrides?
@afbora We could get the actual component and the core component and compare them using ===
. They will only be equal if they point to the same closure.
But to be honest I'm not sure if we should really go this route. Wasn't the reason for the current behavior since 3.6 that people were copying the file URLs and pasting them into fields elsewhere? So we wanted the original, non-changing URLs here. For a file::url
component as in @thisisfuller's example this will still work, but what about CDN plugins etc.? There we would be back again with the original problem.
✅
Description
The file::url component doesn't return the correct url to the panel in 3.6.x, downgrading to 3.5.x solves the issue.
Expected behavior
The open button and image preview links on the panel should use the returned url set on the plugin / component and not the default. See the URLS below on the screenshots bottom left.
Kirby 3.6.2 Screenshot Kirby 3.5.8 Screenshot
To reproduce