all repos — fsrv @ c2d44280e58720f9047698f846387c7d3470b603

filehost server for x.icyphox.sh

Fix panic
Anirudh Oppiliappan x@icyphox.sh
Sun, 27 Nov 2022 12:51:29 +0530
commit

c2d44280e58720f9047698f846387c7d3470b603

parent

daa1c66a38a7f414f2bc559bbae86605d4318722

1 files changed, 6 insertions(+), 3 deletions(-)

jump to
M main.gomain.go

@@ -33,10 +33,13 @@ }

func getKey(r *http.Request) string { var key string - header := r.Header.Get("Authorization") - key = strings.Split(header, " ")[1] + key = r.FormValue("key") if key == "" { - key = r.FormValue("key") + header := r.Header.Get("Authorization") + split := strings.Split(header, " ") + if len(split) == 2 { + key = split[1] + } } return key }