core icon indicating copy to clipboard operation
core copied to clipboard

While editing page/entry/..<ContentType> with no image set, 404 response in the background

Open Wieter opened this issue 6 years ago • 5 comments

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'

Wieter avatar Oct 30 '20 13:10 Wieter

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.

Wieter avatar Oct 30 '20 13:10 Wieter

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? :-)

I-Valchev avatar Nov 03 '20 12:11 I-Valchev

Sure, I have to work on some other fixes as well (postgres related).

Wieter avatar Nov 03 '20 14:11 Wieter

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.

github-actions[bot] avatar Nov 27 '25 07:11 github-actions[bot]

This issue was closed because it has been stalled for 90 days with no activity. Feel free to open a new issue if necessary!

github-actions[bot] avatar Jan 02 '26 07:01 github-actions[bot]