You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
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.
The text was updated successfully, but these errors were encountered: