Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Classic UI: escape HTML characters #3748

Merged
merged 1 commit into from Jul 6, 2017
Merged

Classic UI: escape HTML characters #3748

merged 1 commit into from Jul 6, 2017

Conversation

lolodomo
Copy link
Contributor

Fix #3743

Signed-off-by: Laurent Garnier lg.hc@free.fr

@lolodomo
Copy link
Contributor Author

lolodomo commented Jun 26, 2017

For information, I was not able to fix the particular case of the selection element: when you open the sub-page to select amongs a list, if your label is defined as "TV <TV-ok>" in the sitemap mapping, only "TV" will be displayed.

@lolodomo
Copy link
Contributor Author

lolodomo commented Jun 26, 2017

As a side note, I replaced the code in escapeURLPath by the code from Basic UI. Using new URI(null, null, path, null).toString();was failing with the exception in cases where URLEncoder.encode(path, "UTF-8");is working. Of course, icons are still displayed correctly.

@lolodomo
Copy link
Contributor Author

lolodomo commented Jul 3, 2017

@resetnow : could you please review this PR ? The changes are more or less the same changes you already reviewed for Basic UI.

Copy link
Contributor

@vlad-ivanov-name vlad-ivanov-name left a comment

Choose a reason for hiding this comment

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

The following testcase still demonstrates lack of escaping:

  1. Add the following to the sitemap:
    Text item=DemoString label="Message [%s]" {
        Text item=DemoString label="Message [%s]"
    }
    
  2. Open ClassicUI and navigate into "Message" frame
  3. Type smarthome update DemoString "test <i>test</i>"
  4. Page will update, and HTML tags in the frame header (at the top of the page) will not be escaped.

@lolodomo
Copy link
Contributor Author

lolodomo commented Jul 3, 2017

How do you enter a console command when you start OH from Eclipse ?

An alternative to test your case would be to define a rule.

@vlad-ivanov-name
Copy link
Contributor

I think console for input is already allocated in the default run configuration, just paste the command where the output is.

@lolodomo
Copy link
Contributor Author

lolodomo commented Jul 3, 2017

I was not aware that it was possible ! But it works.I can confirm your test case.

@lolodomo
Copy link
Contributor Author

lolodomo commented Jul 3, 2017

@resetnow : what's wrong with that HTML code:
<title set="wa0201" style="">Message test &lt;i&gt;test&lt;/i&gt;</title>
The text betwen <i> and </i> appears in italic

@lolodomo
Copy link
Contributor Author

lolodomo commented Jul 3, 2017

Same problem with an hardcoded label in sitemap like this one:

Text label="Group <i>Demo</i>" icon="firstfloor" {
}

@lolodomo
Copy link
Contributor Author

lolodomo commented Jul 3, 2017

It seems to be exactly the same problem I found in the selection list and I was not able to fix it !
I hope you can tell me what's wrong with this HTML code and what to do to fix it.

@9037568
Copy link
Contributor

9037568 commented Jul 3, 2017

I'm curious why you'd ask something to be rendered in italics and then be surprised when it's rendered in italics?

@lolodomo
Copy link
Contributor Author

lolodomo commented Jul 4, 2017

We just want to display the value of an item that can contain anything without any interpretation by the HTML browser. Italic was just an example but the problem is in fact with any XML tag.
I don"t understand why escaping is working everywhere except in the title tag. Probably something obvious but I am not a confirmed HTML developer.

@9037568
Copy link
Contributor

9037568 commented Jul 4, 2017

Maybe this has a solution?

@lolodomo
Copy link
Contributor Author

lolodomo commented Jul 4, 2017

I will have to try how Basic UI handles that case. As the escaping code is the same in Basic UI and Classic UI, U would not understand why it us correct in Basic UI and not in Classic UI.

@vlad-ivanov-name
Copy link
Contributor

vlad-ivanov-name commented Jul 4, 2017 via email

@lolodomo
Copy link
Contributor Author

lolodomo commented Jul 4, 2017

I just checked the layer.html in Basic UI and I can find this:
<title><![CDATA[ %label% ]]></title>
while in Classic UI:
<title set="wa%id%" style="%labelstyle%">%label%</title>
Il will try to add CDATA...

Fix #3743

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
@lolodomo
Copy link
Contributor Author

lolodomo commented Jul 4, 2017

Problem with title is now fixed.

Copy link
Contributor

@vlad-ivanov-name vlad-ivanov-name left a comment

Choose a reason for hiding this comment

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

LGTM

@sjsf sjsf merged commit 5d169f1 into eclipse-archived:master Jul 6, 2017
@sjsf
Copy link
Contributor

sjsf commented Jul 6, 2017

Thank you all!

@lolodomo lolodomo deleted the classic_escape branch July 6, 2017 16:29
@kaikreuzer kaikreuzer added this to the 0.9.0 milestone Nov 30, 2017
@kaikreuzer kaikreuzer added the bug label Dec 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants