Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text: Value 0 not displayed #1500

Merged
merged 1 commit into from
Nov 29, 2024

Conversation

bartbutenaers
Copy link
Contributor

Description

When a numeric value 0 is injected into the ui-text widget, it will not be shown.

The problem is that all input values are being sanetized (to avoid XSS attacks), however that should only be done for html content. Because it seems that e.g. DOMPurify.sanitize(0) results in an empty string "".

Example flow:

image

[{"id":"fe8b86bda5fb5fc1","type":"ui-text","z":"4aad778b57d4f47b","group":"bd4b3eed126bd60e","order":0,"width":0,"height":0,"name":"","label":"original","format":"{{msg.payload}}","layout":"row-spread","style":false,"font":"","fontSize":16,"color":"#717171","wrapText":false,"className":"","x":2560,"y":200,"wires":[]},{"id":"0f0abf36e4075908","type":"inject","z":"4aad778b57d4f47b","name":"Number 0 (failed)","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":2360,"y":200,"wires":[["fe8b86bda5fb5fc1"]]},{"id":"22ca3126cfdb84cd","type":"inject","z":"4aad778b57d4f47b","name":"String 0","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"str","x":2390,"y":280,"wires":[["fe8b86bda5fb5fc1"]]},{"id":"740517063d875f8c","type":"inject","z":"4aad778b57d4f47b","name":"Number 1","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":2380,"y":240,"wires":[["fe8b86bda5fb5fc1"]]},{"id":"c88c27a5c93d4348","type":"inject","z":"4aad778b57d4f47b","name":"String 1","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"str","x":2390,"y":320,"wires":[["fe8b86bda5fb5fc1"]]},{"id":"bd4b3eed126bd60e","type":"ui-group","name":"Html labels demo","page":"febf51051870b4b5","width":"6","height":"1","order":1,"showTitle":true,"className":"","visible":"true","disabled":"false"},{"id":"febf51051870b4b5","type":"ui-page","name":"Experimenten labels","ui":"be29745a6e568f30","path":"/experiment_labels","icon":"home","layout":"grid","theme":"a965ccfef139317a","breakpoints":[{"name":"Default","px":"0","cols":"3"},{"name":"Tablet","px":"576","cols":"6"},{"name":"Small Desktop","px":"768","cols":"9"},{"name":"Desktop","px":"1024","cols":"12"}],"order":1,"className":"","visible":false,"disabled":"false"},{"id":"be29745a6e568f30","type":"ui-base","name":"Node-RED","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control","ui-chart","ui-text-input","ui-dropdown"],"showPathInSidebar":false,"showPageTitle":true,"navigationStyle":"icon","titleBarStyle":"default"},{"id":"a965ccfef139317a","type":"ui-theme","name":"Default","colors":{"surface":"#404040","primary":"#109fbc","bgPage":"#e8e8e8","groupBg":"#d6d6d6","groupOutline":"#6fbc10"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px"}}]

Related Issue(s)

1498

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production

Labels

  • Includes a DB migration? -> add the area:migration label

@joepavitt joepavitt merged commit 59efe06 into FlowFuse:main Nov 29, 2024
1 of 2 checks passed
@joepavitt joepavitt changed the title Ui-text value 0 not displayed Text: Value 0 not displayed Nov 29, 2024
@joepavitt joepavitt linked an issue Dec 4, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

text node does not show 0
2 participants