diff --git a/modules/caddyhttp/fileserver/browse.go b/modules/caddyhttp/fileserver/browse.go index 92a1e6ec6..bd4de3ae2 100644 --- a/modules/caddyhttp/fileserver/browse.go +++ b/modules/caddyhttp/fileserver/browse.go @@ -16,6 +16,7 @@ package fileserver import ( "bytes" + _ "embed" "encoding/json" "fmt" "net/http" @@ -31,6 +32,9 @@ import ( "go.uber.org/zap" ) +//go:embed browse.html +var defaultBrowseTemplate string + // Browse configures directory browsing. type Browse struct { // Use this template file instead of the default browse template. diff --git a/modules/caddyhttp/fileserver/browsetpl.go b/modules/caddyhttp/fileserver/browse.html similarity index 96% rename from modules/caddyhttp/fileserver/browsetpl.go rename to modules/caddyhttp/fileserver/browse.html index 06ef06d63..c0ea13108 100644 --- a/modules/caddyhttp/fileserver/browsetpl.go +++ b/modules/caddyhttp/fileserver/browse.html @@ -1,20 +1,4 @@ -// Copyright 2015 Matthew Holt and The Caddy Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package fileserver - -const defaultBrowseTemplate = ` +