From 4890c21012625a4fd75f36c0d4bde989f572d956 Mon Sep 17 00:00:00 2001 From: Timur Ismagilov Date: Sun, 6 Feb 2022 18:14:49 +0500 Subject: [PATCH] Fix /text/ --- web/readers.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/web/readers.go b/web/readers.go index 67320a2..217df39 100644 --- a/web/readers.go +++ b/web/readers.go @@ -140,10 +140,12 @@ func handlerText(w http.ResponseWriter, rq *http.Request) { hyphaName := util.HyphaNameFromRq(rq, "text") switch h := hyphae.ByName(hyphaName).(type) { case *hyphae.EmptyHypha: - default: - log.Println("Serving", h.TextPartPath()) - w.Header().Set("Content-Type", "text/plain; charset=utf-8") - http.ServeFile(w, rq, h.TextPartPath()) + case *hyphae.NonEmptyHypha: + if h.Kind() == hyphae.HyphaText { + log.Println("Serving", h.TextPartPath()) + w.Header().Set("Content-Type", "text/plain; charset=utf-8") + http.ServeFile(w, rq, h.TextPartPath()) + } } }