Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix for strings with extra newlines/carriage returns

The \n escaping is working fine, but for HTML output that still has
weird returns, Javascript will take that as a newline and throw an
"Unterminated string literal" error in the browser-side. Removing \R
after the \n have been escaped solves the issue.

Thank you to bureado <https://github.com/bureado>, who authored this
change and commit.
  • Loading branch information...
commit 76a5bd2f0216a5a0e03317ac3d174b98d6b3b100 1 parent e8c710b
@nospampleasemam nospampleasemam authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/App/DuckPAN/Web.pm
View
2  lib/App/DuckPAN/Web.pm
@@ -113,7 +113,7 @@ sub request {
elsif ($rewrite->wrap_string_callback && $rewrite->callback) {
$body =~ s/"/\\"/g;
$body =~ s/\n/\\n/g;
- $body =~ s/\r//g;
+ $body =~ s/\R//g;
$body = $rewrite->callback.'("'.$body.'");';
}
$response->code($res->code);
Please sign in to comment.
Something went wrong with that request. Please try again.