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

Escape regex in browse.html.ep #527

Merged
merged 1 commit into from
Oct 25, 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
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
Loading