Skip to content

Commit

Permalink
Escape regex in browse.html.ep
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-suse committed Oct 25, 2024
1 parent 31f0764 commit 5153dc3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions lib/MirrorCache/Datamodule.pm
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,11 @@ sub re_pattern($self) {
my ($regex, $glob) = ($self->regex, $self->glob);

my $res = '';
$res = "&REGEX=$regex" if $regex;
$res = "$res&P=$glob" if $glob;
if ($regex) {
$res = "REGEX=$regex";
} elsif ($glob) {
$res = "P=$glob";
}
return $res;
}

Expand Down
9 changes: 6 additions & 3 deletions templates/browse.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,16 @@ a::after{
% if ($folder_id_safe) {
<li class="breadcrumb-item active"><a href="<%= url_for("/app/folder/$folder_id") %>"><%== $bc_last %></a></li>
% } elsif ($bc_last) {
<li class="breadcrumb-item active"><%== $bc_last %></a></li>
<li class="breadcrumb-item active"><%== $bc_last %></li>
% }
</ol>
</div>

% content_for 'ready_function' => begin
setupBrowseTable("<%= $full_path %>");
% if ($re_pattern) {
document.getElementById('browse_api_url').value += "&" + encodeURI("<%=$re_pattern%>");
% }
setupBrowseTable("<%= $full_path %>");
% end

<form id='ajaxform'>
Expand All @@ -77,7 +80,7 @@ a::after{
<tbody>
</tbody>
</table>
<input type="hidden" id="browse_api_url" value="/download<%= $cur_path %>/?jsontable<%==$re_pattern%>"/>
<input type="hidden" id="browse_api_url" value="/download<%= $cur_path %>/?jsontable"/>
</div>
% if ($sl) {
<span style="font-size: 75%;margin-right:2px;">DB was </span>
Expand Down

0 comments on commit 5153dc3

Please sign in to comment.