Problem with the url in the text


#1

I want to pass URLs in text ,that a user can use to get there. In content data i am passing a variable (i.e “{{event.user.url1}}” so i can pass URLs dynamically. The problem is that the URL brakes because ,some special characters are encoded like / that is shown as /
(i.e http://www.gazzetta.gr/football).
I tried to decode the variable with querystring.unescape() or he.decode() but i got the same output.


#2

Does the same occurs for you in markdown?
(It’s possible to set markdown: true in renderer)


#3

@alex yes this also occurs in markdown. Where should i set markdown to true (in renderers.js)? I am a little bit confused,

Thanks in advance


#4

Also had this problem because i ask an user to submit an URL to solve this i decode the url:
const entities = new Entities();
entities.decode(‘url’)


#5

if i type a message inside the json of content data it does decode it correctly, but i have a variable ( {{event.text.url}} ) which it does not decode it in the text shown on the gui. it still shows / instead of /.


#6

@jkar, which botpress version are you using?I wasn’t able to reproduce this issue:


#7

I have the same problem.

I’m using Axios to make a REST request and then I want to display the link in the webchat UI. When I pass the link as a variable back to the UI by adding it to the state, it does not render correctly. I’ve tried to encode with encodeURIComponents, it also fails to be decoded properly. I think the Linkify component is the one that’s causing issues here, but I haven’t really peeled back the library to investigate it further. Links that hard-coded into the UI (i.e. they’re in the text.json file), are rendered correctly.

This is what I get when I append the URL to the scope:
`www.somesite.com/open-account/overview`

Same thing logs as www.somesite.com/open-account/overview in the console.

My code is pretty simple:

    return {
        ...state, // We clone the state
      somevar: uri
            }

I’ve checked my versions and I am using botpress 10.51 (specified in Botfile.js)


#8

@zuzgiertl, how are you rendering that link from the state?