Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix html encoding #521

Merged
merged 2 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dap4/d4servlet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dependencies {
implementation 'edu.ucar:httpservices'
implementation 'edu.ucar:cdm-core'

compileOnly 'org.apache.commons:commons-lang3'
compileOnly 'jakarta.servlet:jakarta.servlet-api'
compileOnly 'org.slf4j:slf4j-api'
}
4 changes: 4 additions & 0 deletions dap4/d4servlet/src/main/java/dap4/servlet/DapDSR.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import java.net.MalformedURLException;
import java.net.URL;

import org.apache.commons.lang3.StringEscapeUtils;

/**
* Generate the DSR for a dataset.
* Currently only generates a minimal DSR.
Expand Down Expand Up @@ -132,6 +134,8 @@ protected String getTemplate(ResponseFormat format) throws IOException {
}

protected void substitute(StringBuilder buf, String macro, String value) {
value = StringEscapeUtils.escapeHtml4(value);

int from = 0;
String tag = "${" + macro + "}";
int taglen = tag.length();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ See LICENSE file for more info.
-->
<head>
<meta http-equiv="Content-Type" content="text/html">
<meta> name="title" content="Dataset Services Response">
<meta name="title" content="Dataset Services Response">
<style>
table.t1, td.t1, th.t1 {border: 1px solid}
td.t1, th.t1 {padding:4px}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ See LICENSE file for more info.
-->
<head>
<meta http-equiv="Content-Type" content="text/html">
<meta> name="title" content="Dataset Services Response">
<meta name="title" content="Dataset Services Response">
<style>
table.t1, td.t1, th.t1 {border: 1px solid}
td.t1, th.t1 {padding:4px}
Expand Down
Loading