Skip to content

Bug fix - Broken Links & HTML Artifacts in Message to Client #932#942

Open
ruwinirathnamalala wants to merge 5 commits intobuerokratt:devfrom
rootcodelabs:bug-fix/932
Open

Bug fix - Broken Links & HTML Artifacts in Message to Client #932#942
ruwinirathnamalala wants to merge 5 commits intobuerokratt:devfrom
rootcodelabs:bug-fix/932

Conversation

@ruwinirathnamalala
Copy link
Collaborator

#932

This fix includes a change in Buerokratt-Chatbot also.

PR in chatbot: buerokratt/Buerokratt-Chatbot#1826

...............................................................................................................................................................

This pull request introduces improvements to how HTML content and links are handled and displayed in bot messages, step nodes, and chat components. It adds robust HTML entity decoding, sanitizes HTML to prevent unsafe content, and ensures links are properly converted and styled. These changes enhance security, readability, and user experience across the interface.

HTML Decoding and Sanitization Enhancements:

  • Added decodeHtmlEntities utility in string-util.ts to reliably decode HTML entities, used throughout the codebase for safer and clearer text rendering.
  • Updated StepNode (StepNode.tsx) to decode and sanitize HTML content before rendering, allowing only safe tags and attributes. [1] [2]
  • Modified message processing in service-builder.ts to decode HTML entities before converting to markdown, improving accuracy and safety. [1] [2]

Link Handling and Markdown Conversion:

  • Introduced htmlLinkToMarkdown in Markdowify/index.tsx to convert HTML <a> tags into markdown links, ensuring consistent formatting and safer rendering in bot messages. [1] [2]

UI and Styling Improvements:

  • Enhanced chat message styling in chat.module.scss to improve link visibility, including custom colors for regular and visited links, and improved text contrast. [1] [2]

Bot Message Rendering:

  • Updated bot message rendering to consistently use markdown formatting, removing legacy HTML stripping logic for <p> tags.

Backend Template Update:

  • Improved bot response template (bot_responses_to_messages.handlebars) to escape quotes and filter control characters for safer and more reliable message content.

const parts = value.split('_');

// Check if the last part is a number
const lastPart = parts[parts.length - 1];
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Sonar suggestion cant be done as it will fail existing behavior

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

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.

1 participant