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

Static resources assigned certain types of templates fail to output a binary static file #16533

Open
SnowCreative opened this issue Feb 24, 2024 · 1 comment
Labels
bug The issue in the code or project, which should be addressed.

Comments

@SnowCreative
Copy link
Contributor

SnowCreative commented Feb 24, 2024

Bug report

Summary

Not sure if this a bug or a feature request, but the way binary static resources are currently processed is non-intuitive.

Step to reproduce

Create a static resource of any binary type (say, PDF) and assign a template that either has no content, or else has an un-cached content field ( like [[!*content]] or a custom snippet that processes content like [[!contentsnippet]] ). Link to the static file and save the resource.

Observed behavior

The linked file will not load on the front end if it's a PDF, and if it's a downloadable binary file, a file with empty content will be downloaded.

Expected behavior

Since binary static resources only load external files, and are not rendering any content needing a template, they should ignore the assigned template completely and output the linked file regardless of assigned template.

If someone makes a static resource, it’s going to be assigned whatever the default template is. If that template has a non-cached content field or snippet, the output is going to be broken, and they won't know why. The expectation is that there shouldn't be a need to change templates, because the resource is just going to output the linked file if it's binary, right?

It's desirable to use a custom template for binary static resources so that form customization can be applied to them, since the only fields really needed are the title and content fields. When I set one up like this, I assumed I could leave the template empty since nothing was going to get rendered using a template. It took a few hours of hair-pulling and a post about this on the support boards to figure out what the problem was.

Environment

Tested in MODX 3.0.4, but this probably applies to all versions.

@SnowCreative SnowCreative added the bug The issue in the code or project, which should be addressed. label Feb 24, 2024
@modxcommunity
Copy link
Collaborator

This issue has been mentioned on MODX Community. There might be relevant details there:

https://community.modx.com/t/binary-static-resources-not-downloading/7555/15

@SnowCreative SnowCreative changed the title Static resources assigned certain types of templates fail to output the static file Static resources assigned certain types of templates fail to output a binary static file Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue in the code or project, which should be addressed.
Projects
None yet
Development

No branches or pull requests

2 participants