summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/fileserver/browse.html
diff options
context:
space:
mode:
authorMatt Holt <mholt@users.noreply.github.com>2023-05-15 10:48:05 -0600
committerGitHub <noreply@github.com>2023-05-15 10:48:05 -0600
commit52d7335c2b1b8424e8971a9b03f51a5f36583535 (patch)
tree23ea631b9bece465b9cfa35367099fe373b6afdd /modules/caddyhttp/fileserver/browse.html
parent96919acc9d583ef11ea1f9c72a9991fb3f8aab9f (diff)
fileserver: Use EscapedPath for browse (#5534)
* fileserver: Use EscapedPath for browse Fix #5143 * Fixes if filter element is not present * Remove extraneous line
Diffstat (limited to 'modules/caddyhttp/fileserver/browse.html')
-rw-r--r--modules/caddyhttp/fileserver/browse.html5
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/caddyhttp/fileserver/browse.html b/modules/caddyhttp/fileserver/browse.html
index c893b64..2afea5e 100644
--- a/modules/caddyhttp/fileserver/browse.html
+++ b/modules/caddyhttp/fileserver/browse.html
@@ -850,11 +850,11 @@ footer {
<script>
const filterEl = document.getElementById('filter');
- filterEl.focus({ preventScroll: true });
+ filterEl?.focus({ preventScroll: true });
function initPage() {
// populate and evaluate filter
- if (!filterEl.value) {
+ if (!filterEl?.value) {
const filterParam = new URL(window.location.href).searchParams.get('filter');
if (filterParam) {
filterEl.value = filterParam;
@@ -874,6 +874,7 @@ footer {
}
function filter() {
+ if (!filterEl) return;
const q = filterEl.value.trim().toLowerCase();
document.querySelectorAll('tr.file').forEach(function(el) {
if (!q) {