guess mimetype
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Arnas Udovic 2023-06-28 08:10:07 +03:00
parent 0c5412c069
commit 509ae1968b
2 changed files with 9 additions and 3 deletions

View file

@ -7,10 +7,15 @@ My capsule in Gemini space. Built with zord-tree support
## TODO ## TODO
* add image or other file not `gmi` download * main.go:173 add content type by extension
* refactor layout
* remove capsule title from simple page
* security * security
* citata from some file * citata from some file
* add pagehint counter in abcex
* add gallery categories. index.md with secret to dynamic generators on build
__DONE__ __DONE__
* add image or other file not `gmi` download
* feed * feed
* add category view * add category view
* add tag view * add tag view

View file

@ -7,6 +7,8 @@ import (
"google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/credentials/insecure"
"io" "io"
"log" "log"
"mime"
"path"
"regexp" "regexp"
"strings" "strings"
"time" "time"
@ -169,8 +171,7 @@ func downloadAttachment(w gemini.ResponseWriter, r *gemini.Request, client TreeM
return return
} }
//w.SetMediaType(http.DetectContentType([]byte(response.Content))) w.SetMediaType(mime.TypeByExtension(path.Ext(filePath)))
w.SetMediaType("image/png")
for { for {
chunkResponse, err := response.Recv() chunkResponse, err := response.Recv()
if err == io.EOF { if err == io.EOF {