Skip to content

href addresses getting altered in emoncms! #171

Closed
@pb66

Description

I have many dashboards that contain images, they range from a simple single image alone on a page to much more complex pages involving multiple images.

Generally these are set up using a simple paragraph widget with some html like this (but they do differ)

<div style="text-align: center;">
<a href="/linked_address"><img src="/images/displayed_image.png" style="max-width: 100%; height: auto;" alt="FYI, image alt text is required">
</a></div>

this has worked well for a substantial time, recently I updated the sever that was running 9.8.18 and the dashboard module version of that time, to the very latest versions as of now.

I have just tried to change an image and keep getting this error

image

all I have done to get that error is change the image url by 1 character (eg "displayed_image.png" to "displayed_image1.png") both images are present and correct, I have even tried copying "displayed_image.png" to "displayed_image1.png" so it is even the same file it is trying to load/locate.

I have since searched every where I could think of and eventually found that all the href entries in the mysql dashboard table has "&#10;" appended to the end of the url. eg src="/images/displayed_image.png ". Armed with this info I have looked at the dashboard configuration content editor (designed for cutting and pasting content between dashes) and found the "&#10;" is also shown there, but when viewing the same href url via the paragraph widget configuration box in the dashboard editor, it is filtered and doesn't show the "&#10;" even though it is present in the source.

I have now proved this is the cause of the error I see by editing the href url in the content editor to remove the "&#10;" it will save and work fine, obviously there doesn't appear to be any change when viewed via the widget editor as the extra " " doesn't show beforehand.

My original task was to change 1 image on a page of 32 images. I have managed to achieve this by manually editing every one of the 32 image urls (to remove the "&#10;" and add the single "1" to the image url in question) as editing any one or any number less than ALL of the links resulted in the same error being raised when saving.

I do not know how those extra chars were added (by emoncms) but I do know that I have dozens of accounts and many dozens of these pages that all need the "&#10;" removed from the end of many href urls. Is there a safe automated way to do this on a live server? or could what ever the paragraph widget box does to filter the source be embraced to remove these unwanted extra's when saving a dash?

It's really annoying that the paragraph widget displays correctly when the source is wrong and yet, it says there is "no change" when you try to re-save without adding further changes, if it would just save what it displays (forced even though no change detected) it might remove the "&#10;" itself.

In fact, this check for change and block saving if no changes detected has really hindered debugging this issue. If it was possible to open a dashboard for editing and attempt a save without being told there are no changes, it would have raised the error about "invalid content" and that would have rang alarm bells as the dash content was unchanged, the fact it forces me to make changes and only then triggers an error, suggests there is an error with the changes not the original source.

I have to say, having just had to re-edit all the "&#10;" strings in this post as they display as " " without adding the backticks like so

"`&#10;`"

I do not cherish the idea of trying to do a mysql query to edit by regex!!!

PS - All the images and dashboards seem to display ok, this is just an issue with resaving the dashes after any edits.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions