diff options
author | navanchauhan <navanchauhan@gmail.com> | 2023-01-18 19:06:16 -0700 |
---|---|---|
committer | navanchauhan <navanchauhan@gmail.com> | 2023-01-18 19:06:16 -0700 |
commit | 28dbcf0d397ac4bff1838a4af309a25d9c1e0cc1 (patch) | |
tree | b9fa3b9b572b9fa720d7a3dc6ca3bfefda33a755 | |
parent | 6a0ce5ee4f4ffed70dbedce5590d1afc6c1e9b6c (diff) |
fix summary url function
-rw-r--r-- | main.go | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -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" } } |