From eeb873a74972cdc40d172db9a30fd3ce5ef13edb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=E8=8F=8C?= Date: Thu, 28 Apr 2022 21:07:39 +0800 Subject: [PATCH] update --- route/tinyurl/tinyurl.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/route/tinyurl/tinyurl.go b/route/tinyurl/tinyurl.go index ce2b652..1f76450 100644 --- a/route/tinyurl/tinyurl.go +++ b/route/tinyurl/tinyurl.go @@ -54,7 +54,7 @@ func TinyUrl(c flamego.Context, w http.ResponseWriter, form Param, errs binding. _, _ = c.ResponseWriter().Write([]byte(fmt.Sprintf("Oops! Error occurred: %v", err))) return } - if !strings.HasPrefix(form.LongUrl, "http://") || !strings.HasPrefix(form.LongUrl, "https://") { + if !strings.HasPrefix(form.LongUrl, "http://") && !strings.HasPrefix(form.LongUrl, "https://") { form.LongUrl = "http://" + form.LongUrl } logger.Info(c.Request().Context(), form.LongUrl)