Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

html in href in text comp is encoded

Avatar

Avatar
Ignite 1
Level 1
shivakumark6662
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Ignite 1
Validate 1
View profile

Avatar
Ignite 1
Level 1
shivakumark6662
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Ignite 1
Validate 1
View profile
shivakumark6662
Level 1

27-05-2020

If you try to save a value like this for the href :

 

http://...emailAddress=<span class=email>EmailAddress</span>&URL=https://../global/en/home/library/measurements.html

 

It is replaced with encoded chars for the < and > in the <span> tag. e.g. it becomes

 

http://...emailAddress=%3Cspan%20class=email%3EEmailAddress%3C/span%3E&URL=https://../global/en/home/library/measurements.html

 

after you save the component, reload the page, and go back to edit again.

It should allow the < and > tags

 

characters such as less-than (<), greater-than (>)  get encoded, but should not be

 

AEM 6.4.7 instance

 

Capture.PNG

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
MVP
Theo_Pendle
MVP

Likes

236 likes

Total Posts

251 posts

Correct Reply

105 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 10
Ignite 1
View profile

Avatar
Validate 1
MVP
Theo_Pendle
MVP

Likes

236 likes

Total Posts

251 posts

Correct Reply

105 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 10
Ignite 1
View profile
Theo_Pendle
MVP

27-05-2020

Hi @shivakumark6662,

I don't really understand the problem. It is totally normal for the href attribute to be encoded, as it should be. This is because URLs must be encoded to function to function correctly.

Even if you could have an un-encoded href, any modern browser will just encode the URL before making a request. Take a look at this example:

Theo_Pendle_0-1590594573992.png

As you can see, even though I tried to access a URL with un-encoded XML characters, Chrome made a request using their encoded equivalents. With that in mind, there would be no point in creating a "fix" to allow un-encoded href attributes, because they would just be overriden by your browser.

Just to further illustrate the point, we can try the same request via curl:

$ curl http:localhost:8081?xml=<span></span>
bash: syntax error near unexpected token `<'

As you can see we get an error since unlike Chrome, curl doesn't automatically encode the URL.

Can you explain why you want un-encoded href attributes? 

 

Answers (0)