diff --git a/cmd/root.go b/cmd/root.go index fe6fcd3..7344731 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -11,7 +11,7 @@ import ( ) const ( - ReleaseVersion string = "0.90.1" + ReleaseVersion string = "0.90.3" ) var ( diff --git a/cmd/web.go b/cmd/web.go index 60ec0b4..5d80f64 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -96,9 +96,7 @@ func serveStaticFile(paths []string, cache *fileCache, errorChannel chan<- error return } - w.Write(buf) - - fileSize := humanReadableSize(len(buf)) + written, _ := w.Write(buf) refererUri, err := stripQueryParams(refererToUri(r.Referer())) if err != nil { @@ -124,7 +122,7 @@ func serveStaticFile(paths []string, cache *fileCache, errorChannel chan<- error fmt.Printf("%s | Serve: %s (%s) to %s in %s\n", startTime.Format(logDate), filePath, - fileSize, + humanReadableSize(written), realIP(r), time.Since(startTime).Round(time.Microsecond), ) @@ -296,7 +294,7 @@ func serveMedia(paths []string, regexes *regexes, cache *fileCache, formats *typ formattedPage := gohtml.Format(htmlBody.String()) - _, err = io.WriteString(w, formattedPage) + written, err := io.WriteString(w, formattedPage) if err != nil { errorChannel <- err @@ -310,7 +308,7 @@ func serveMedia(paths []string, regexes *regexes, cache *fileCache, formats *typ fmt.Printf("%s | Serve: %s (%s) to %s in %s\n", startTime.Format(logDate), path, - humanReadableSize(len(formattedPage)), + humanReadableSize(written), realIP(r), time.Since(startTime).Round(time.Microsecond), ) diff --git a/types/code/code.go b/types/code/code.go index dba0412..e40e58c 100644 --- a/types/code/code.go +++ b/types/code/code.go @@ -222,7 +222,7 @@ func (t Format) Validate(filePath string) bool { } func (t Format) Type() string { - return "html" + return "inline" } func New(theme string) Format { diff --git a/types/text/text.go b/types/text/text.go index 0e76c45..24020ad 100644 --- a/types/text/text.go +++ b/types/text/text.go @@ -77,7 +77,7 @@ func (t Format) Validate(filePath string) bool { } func (t Format) Type() string { - return "html" + return "inline" } func New() Format {