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

Preview links of some files aren't working #6786

Open
samlinck opened this issue Nov 12, 2024 · 7 comments
Open

Preview links of some files aren't working #6786

samlinck opened this issue Nov 12, 2024 · 7 comments
Labels
needs: discussion 🗣 Requires further discussion to proceed type: regression 🚨 Is a regression between versions
Milestone

Comments

@samlinck
Copy link

Description

The preview link for some files appears as a button instead of a standard link. As a result, clicking it does nothing. However, the file can be accessed by manually copying and pasting the URL.

Initially, I thought it was a Dreamform bug since the file was uploaded through Dreamform. However, after further testing, we found that some files not uploaded via Dreamform also have this issue. Referring issue

Expected behavior

The preview link opens the file url in a new tab.

Screenshots
The file I have problems with
image

The preview button html
image

To reproduce

  1. Go to a file
  2. Try to click on the preview link

Your setup

Kirby Version
4.4.1

Console output
image

Your system (please complete the following information)

  • Device: Macbook Pro
  • OS: MacOs 14.5
  • Browser: Chrome
  • Version: 130.0.6723.117 (Official Build) (arm64)

Additional context

@distantnative
Copy link
Member

Can you reproduce it with a fresh starter kit? Or any actual description to reproduce it? Cause the steps you describe just work fine with the demo kit: https://getkirby.com/try

@distantnative distantnative added the needs: replication 🔬 Requires a sample to reproduce the issue label Nov 12, 2024
@samlinck
Copy link
Author

samlinck commented Nov 12, 2024

Hi sorry for the missing info. I can't reproduce the issue with files uploaded via the panel. But the plugin author does have the issue with other files uploaded via the panel.

  1. Install the starterkit
  2. Install Dreamform
  3. Make a form with an upload field
  4. Upload an image (I tried jpg, png, pdf, gif, mp4) via the form
  5. Visit the submission in the panel
  6. Go to file in the panel
  7. Try to preview file (This doesn't work)

@dominiklaube
Copy link

I can reproduce the issue as described here. The problem occurs when uploading a file to a page with a blueprint that has the preview permission set to false.

What would be the correct solution here? Sometimes, you may want to disable the page preview while still allowing the file preview.

I also noticed in the screenshot that the button classname "k-file-view-options" might be incorrect and should perhaps be "k-file-view-preview" instead.

@nilsmielke
Copy link

nilsmielke commented Nov 19, 2024

Can confirm @dominiklaube’s findings.
Setting preview: true in the page template of the page the file was loaded into, fixes the file preview—as a temporary fix, that is.

@distantnative distantnative added type: bug 🐛 Is a bug; fixes a bug and removed needs: replication 🔬 Requires a sample to reproduce the issue labels Nov 21, 2024
@distantnative
Copy link
Member

@dominiklaube @nilsmielke thanks for figuring out how to reproduce the issue, very helpful. I can replicate it as well.

@distantnative
Copy link
Member

It's caused by this commit: bc2e9fc

My question to you, @samlinck @dominiklaube @nilsmielke, would be if the commit has the right intention and the file preview should also be gone if the parent page preview is disabled (and we just need to fix the UI to not show the button) or if you have use cases where this behavior is problematic and the file preview should be independent.

@distantnative distantnative added needs: discussion 🗣 Requires further discussion to proceed type: regression 🚨 Is a regression between versions and removed type: bug 🐛 Is a bug; fixes a bug labels Nov 21, 2024
@distantnative distantnative added this to the 4.5.0 milestone Nov 21, 2024
@nilsmielke
Copy link

@distantnative In my use case, the file preview is intended in a page, that is not previewable. The page only holds information, that is not displayed on a single page basis in the frontend, thus, the preview is futile. Still, the file needs to be downloadable from the panel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: discussion 🗣 Requires further discussion to proceed type: regression 🚨 Is a regression between versions
Projects
None yet
Development

No branches or pull requests

4 participants