While editing page/entry/..<ContentType> with no image set, 404 response in the background
Not breaking, but some room for a small improvement.
While setting up a new website, and editing pages/entries/(doesn't really matter what), I noticed a 404 response in the console:
GET https://.../bolt/edit/null 404 (Not Found)
This I traced back to an empty image field (there was no 'Highlighted image' for the ContentType which is being edited, which is correct)
The preview image field is templated to become the following:
<a class="editor__image--preview-image" style="background-image: url('null');"></a>
Probably a check need to be made if 'null' is returned, and then just omit setting the background-image.
I haven't dissected yet where the template is rendered, will do so in due time :)
Details
| Question | Answer |
|---|---|
| Relevant Bolt Version | 4.1 |
| Install type | Composer install |
| BC Break | no |
| PHP version | 7.2 |
| Web server | Apache, version 2.4.46 |
| For UX/UI issues | N/A |
Reproduction
Bug summary
404 for pages/entries/.. without highlighted image in editor
Specifics
Steps to reproduce
- Install BOLT the usual way, using PostgreSQL as backend
- open developer console of the browser, and watch the traffic flow
- edit page/entry/whatever... that does not have set a highlight image
Expected result
No unnecessary 'chitchat' with the server when no image is present
Actual result
404 in the background, trying to resolve 'null'
Some findings:
https://github.com/bolt/core/blob/6bf1db6f7994193b6c90622fe5d127388582969a/assets/js/app/editor/Components/Image.vue#L126 previewImage is checked for empty string, but further down thumbnailImage is used.
https://github.com/bolt/core/blob/6bf1db6f7994193b6c90622fe5d127388582969a/assets/js/app/editor/Components/Embed.vue#L87 no check is embedded to test if this field might be empty, then if empty :style="background-image: url('${previewImage}')" could cause this 404 while trying to retrieve null.
hi @Wieter , nice little catch! Would you like to create a small PR to fix this, so that you also show up as a bolt/core contributor? :-)
Sure, I have to work on some other fixes as well (postgres related).
In an effort to keep our issue list manageable, we are marking this issue as stale because it has been 60 days without activity. If this issue is still relevant, please let us know by posting a quick comment so that it remains open.
This issue was closed because it has been stalled for 90 days with no activity. Feel free to open a new issue if necessary!