go-podcast-proxy/handle-file.go

18 lines
395 B
Go
Raw Permalink Normal View History

2024-08-03 20:05:08 +02:00
package main
import (
"net/http"
"strings"
"log"
2024-08-03 20:05:08 +02:00
)
func (ctx *ServerContext) HandleFile(w http.ResponseWriter, req *http.Request) error {
ctx.WG.Add(1)
defer ctx.WG.Done()
log.Println("requested file ", req.URL.Path)
if strings.HasPrefix(req.URL.Path, "/file/") {
http.ServeFile(w, req, ctx.Config.FileRoot + "/" + req.URL.Path[6:]);
}
2024-08-03 20:05:08 +02:00
return nil
}