fix: fixed wrong extension detection in the handler.
This commit is contained in:
parent
aab905e78c
commit
9a31905ff7
2 changed files with 7 additions and 3 deletions
|
@ -108,7 +108,7 @@ func (h *Handler) ServeHTTP(
|
|||
urlPath := r.URL.Path
|
||||
// Cleaning URL path to prevent injections.
|
||||
urlPath = path.Clean(urlPath)
|
||||
urlExt := path.Ext(urlPath)
|
||||
//urlExt := path.Ext(urlPath)
|
||||
|
||||
filePath := filepath.Join(
|
||||
filepath.FromSlash(h.sourcePath),
|
||||
|
@ -165,7 +165,8 @@ func (h *Handler) ServeHTTP(
|
|||
|
||||
// Setting before the code to let it change own
|
||||
// content type?
|
||||
contentType := mime.TypeByExtension(urlExt)
|
||||
fileExt := filepath.Ext(filePath)
|
||||
contentType := mime.TypeByExtension(fileExt)
|
||||
w.Header().Set("Content-Type", contentType)
|
||||
processedData := fileData
|
||||
if shouldProcess {
|
||||
|
|
|
@ -7,7 +7,10 @@
|
|||
|
||||
{{
|
||||
pp.print(
|
||||
html.h1().body("This is the example page for THT")
|
||||
html.h1().body("This is the example page for THT"),
|
||||
html.p().body(
|
||||
"Какое-то количество русского текста"
|
||||
)
|
||||
)
|
||||
pp.print("some more shit")
|
||||
|
||||
|
|
Loading…
Reference in a new issue