remove old stuff
Former-commit-id: f949756dffe9ce68d44f918e21fe109f9e9b3781 [formerly 525d578af04dcefe398762b4dac65773dd50bd22] [formerly e26096838f2289c45baab960ebb816db93aad2e0 [formerly 7d915db98bae4fab955d2aea406550570f7f9358]] Former-commit-id: cba7a91df31c55ed1cf925e03aac071de46af78c [formerly a83f7b28158b6fba36b092a7146716b970a1b615] Former-commit-id: 8b3f0771752d3d64e06a2e059c48987ee12f3958
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
package assets
|
||||
|
||||
import (
|
||||
"mime"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/hacdias/caddy-filemanager/config"
|
||||
)
|
||||
|
||||
// BaseURL is the url of the assets
|
||||
const BaseURL = "/_filemanagerinternal"
|
||||
|
||||
// Serve provides the needed assets for the front-end
|
||||
func Serve(w http.ResponseWriter, r *http.Request, c *config.Config) (int, error) {
|
||||
// gets the filename to be used with Assets function
|
||||
filename := strings.Replace(r.URL.Path, c.BaseURL+BaseURL, "public", 1)
|
||||
file, err := Asset(filename)
|
||||
if err != nil {
|
||||
return http.StatusNotFound, nil
|
||||
}
|
||||
|
||||
// Get the file extension and its mimetype
|
||||
extension := filepath.Ext(filename)
|
||||
mediatype := mime.TypeByExtension(extension)
|
||||
|
||||
// Write the header with the Content-Type and write the file
|
||||
// content to the buffer
|
||||
w.Header().Set("Content-Type", mediatype)
|
||||
w.Write(file)
|
||||
return 200, nil
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
4c30378a214b5b33410a74961df51cbc21bd6122
|
||||
Reference in New Issue
Block a user