From 28dbcf0d397ac4bff1838a4af309a25d9c1e0cc1 Mon Sep 17 00:00:00 2001 From: navanchauhan Date: Wed, 18 Jan 2023 19:06:16 -0700 Subject: fix summary url function --- main.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index b28e620..37de093 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,6 @@ import ( "log" "net/http" "os" - "strconv" "github.com/getsentry/sentry-go" "github.com/joho/godotenv" @@ -24,11 +23,10 @@ var globalVariables = GlobalVars{ var static embed.FS func create_pdf_url(year string, knumber string) string { - year_int, _ := strconv.Atoi(year[0:2]) - if year[0] == '0' || year[0] == '1' || year[0] == '2' || year[0] == '3' || year[0] == '4' || year[0] == '5' && year[0:2] != "01" && year[0:2] != "00" { - return fmt.Sprintf("https://www.accessdata.fda.gov/cdrh_docs/pdf%d/%s.pdf", year_int, knumber) + if year[0] >= '0' && year[0] <= '5' && year[:2] != "01" && year[:2] != "00" { + return "https://www.accessdata.fda.gov/cdrh_docs/pdf" + year[:2] + "/" + knumber + ".pdf" } else { - return fmt.Sprintf("https://www.accessdata.fda.gov/cdrh_docs/pdf/%s.pdf", knumber) + return "https://www.accessdata.fda.gov/cdrh_docs/pdf/" + knumber + ".pdf" } } -- cgit v1.2.3