aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules/caddyhttp/fileserver/browse.html
diff options
context:
space:
mode:
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 c893b6401..2afea5ee4 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) {