Skip to content

Commit

Permalink
escape url on error page
Browse files Browse the repository at this point in the history
  • Loading branch information
m4rk3r committed Sep 7, 2022
1 parent a99e3d6 commit 5a83e7e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion webrecorder/webrecorder/maincontroller.py
Expand Up @@ -333,7 +333,7 @@ def is_out_of_space(context):
def trunc_url_expand(value):
""" Truncate querystrings, appending an ellipses, expand on click
"""
trunc_value = '?<span class="truncate-expand" aria-role="button" title="Click to expand" onclick="this.innerHTML=\''+value.split('?')[-1]+'\'; this.classList.add(\'open\');">...</span>'
trunc_value = '?<span class="truncate-expand" aria-role="button" title="Click to expand" onclick="this.innerText=\''+value.split('?')[-1]+'\'; this.classList.add(\'open\');">...</span>'
return re.sub(r'(\?.*)', trunc_value, value)

def trunc_url(value):
Expand Down
4 changes: 2 additions & 2 deletions webrecorder/webrecorder/templates/content_error.html
Expand Up @@ -108,7 +108,7 @@ <h1>Resource not Found</h1>
<button id="bug-report" type="button" class="btn btn-default btn-xs" data-toggle="button" aria-pressed="false" autocomplete="off">Still missing? Report a bug.</button>
{% endif %}

<p>The url <b>{{ url|trunc_url_expand }}</b> was not found in the archive.</p>
<p>The url <b>{{ url|e|trunc_url_expand }}</b> was not found in the archive.</p>
</div>
</div>
{% elif status == 402 %}
Expand All @@ -119,7 +119,7 @@ <h1>Resource not Found</h1>
<div class="content-error-info">
<h1>This site could not be loaded</h1>

<p><b>{{ url|trunc_url }}</b></p>
<p><b>{{ url|e|trunc_url }}</b></p>

<p>Please double check that this url is valid.</p>
</div>
Expand Down

0 comments on commit 5a83e7e

Please sign in to comment.