Files
plainleaf/server/util.go
T
Zef HemelandGitHub a524c64884 Go backend (#1555)
* Replaces old Deno server with a Go implementation
* Restructured the code base accordingly
2025-09-19 13:23:20 +02:00

20 lines
381 B
Go

package server
import (
"mime"
"path/filepath"
)
// lookupContentTypeFromPath determines MIME type based on file extension
func LookupContentTypeFromPath(path string) string {
ext := filepath.Ext(path)
if ext == ".md" {
return "text/markdown"
}
contentType := mime.TypeByExtension(ext)
if contentType == "" {
return "application/octet-stream"
}
return contentType
}