Skip to content

🐛 Bug Report: Parsing of '&' when sent over Novu payload #9023

@will-thomson4

Description

@will-thomson4

📜 Description

Hello, I'm seeing this issue whereby any time an & is sent over Novu it comes out the other side as & Both in the payload and in urls.

For example if I have this component in a React app.

import type { Notification } from '@novu/js';
import { Inbox, NovuProvider, Tab, useNovu } from '@novu/react';
import { toast } from 'sonner';

function NovuInboxContent({ subscriberId, tabs }: { subscriberId: string; tabs: Tab[] }) {
  const novu = useNovu();
  const navigate = useNavigate();

  useEffect(() => {
    // Handler for new notifications
    const handleNewNotification = ({ result }: { result: Notification }) => {
          const url = result.primaryAction?.redirect?.url;
          const name = result.data.name // Where name is a field I'm sending across in the payload
     })
    
    const unsubscribeNotificationReceived = novu.on('notifications.notification_received', handleNewNotification);
    
    return () => {
      unsubscribeNotificationReceived();
    };
  }, [novu]);

In this code, if there is an & in url or name they come out as & Even in the component from Novu, anything which has a & in the name will come out as & instead.

👟 Reproduction steps

Just send any notification with a & in the payload.

👍 Expected behavior

If an & is sent it should just be a &.

👎 Actual Behavior with Screenshots

If an & is sent it is a &

Novu version

Using "@novu/react": "^3.6.0" package

npm version

Using yarn 1.22.22

node version

20.18.1

📃 Provide any additional context for the Bug.

No response

👀 Have you spent some time to check if this bug has been raised before?

  • I checked and didn't find a similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to submit PR?

None

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions