Snapin Characters replacement on textboxes
-
When I add/remove storage groups, and modify the membership of a snapin, from snapins management page, the values on textbox are replaced changing special characters by html entities, for example where i have " is changed by " where I have " is replaced by "
Verified on versions 1.5.6 and 1.5.9 clean installations.
-
@EduardoTSeoane Please test on dev-branch as well and let us know.
-
I update the server to dev-branch and and again, it happens.
Editing Snapins:
On Add/Remove/Update Storage Groups
On Add/Remove hosts on Membershipas a dirty temporal patch I add this code to solve it:
$this->obj->set('description', htmlspecialchars_decode($this->obj->get('description'))); $this->obj->set('name', htmlspecialchars_decode($this->obj->get('name'))); $this->obj->set('args', htmlspecialchars_decode($this->obj->get('args'))); $this->obj->set('hash', htmlspecialchars_decode($this->obj->get('hash'))); $this->obj->set('runWith', htmlspecialchars_decode($this->obj->get('runWith'))); $this->obj->set('runWithArgs', htmlspecialchars_decode($this->obj->get('runWithArgs'))); $this->obj->set('timeout', htmlspecialchars_decode($this->obj->get('timeout')));
On file /fog/lib/pages/snapinmanagementpage.class.php between lines 1653 and 1654.
On file /fog/lib/fog/fogpage.class.php between lines lines 3604 and 3065 -
@EduardoTSeoane And another old one I came across. This one is still an issue. I have dug through a lot of code today to try and properly fix this. While there are different ways of getting this right I didn’t want to mess with too much of the code and introduce new problems. In case anyone comes across this, feel free to look into it again and see if there is a better way.
- Remove general encoding of HTML special chars (in FOGBase class) and add it where needed instead. This would be a lot of places (e.g. 1) because HTML output is generated throughout the code - so re-working pretty much all of that. As well this would also change the output we get from the API for example. Currently HTML encoded for no good reason I think. But changing that could break things for people being used to it.
- Another way would be to prevent the whole object from being saved in general when only associations should be set. This happens in many places as well (e.g. 2, 3). Same as above it would mean re-working a lot of the code. Although it’s probably worth it to reduce the amount of unnecessary changes being written to the database (improve performance a little).
- So I chose the simplest route of all to just fix this for snapins in dev-branch (4). It’s not perfect but at least the actual issue is fixed for snapins where chars like
"
and>
are used by people. FOG still messes up those characters in other places, e.g. host/image description.