Skip to content

Commit

Permalink
Add html escape to session name
Browse files Browse the repository at this point in the history
## What changes were proposed in this pull request?

The PR adds HTML escaping to session names.

## How was this patch tested?

Manual test.

Author: Marco Gaido <[email protected]>

Closes apache#302 from mgaido91/escape_html.
  • Loading branch information
mgaido91 authored and ajbozarth committed Aug 15, 2020
1 parent 97cf2f7 commit 4d8a912
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@
* limitations under the License.
*/

function escapeHtml(unescapedText) {
return $("<div>").text(unescapedText).html()
}

function loadSessionsTable(sessions) {
$.each(sessions, function(index, session) {
$("#interactive-sessions .sessions-table-body").append(
"<tr>" +
tdWrap(uiLink("session/" + session.id, session.id)) +
tdWrap(appIdLink(session)) +
tdWrap(session.name) +
tdWrap(escapeHtml(session.name)) +
tdWrap(session.owner) +
tdWrap(session.proxyUser) +
tdWrap(session.kind) +
Expand All @@ -38,7 +42,7 @@ function loadBatchesTable(sessions) {
"<tr>" +
tdWrap(session.id) +
tdWrap(appIdLink(session)) +
tdWrap(session.name) +
tdWrap(escapeHtml(session.name)) +
tdWrap(session.owner) +
tdWrap(session.proxyUser) +
tdWrap(session.state) +
Expand Down Expand Up @@ -79,4 +83,4 @@ $(document).ready(function () {
$("#all-sessions").append('<h4>No Sessions or Batches have been created yet.</h4>');
}
});
});
});

0 comments on commit 4d8a912

Please sign in to comment.