summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authornavanchauhan <navanchauhan@gmail.com>2023-01-18 19:06:16 -0700
committernavanchauhan <navanchauhan@gmail.com>2023-01-18 19:06:16 -0700
commit28dbcf0d397ac4bff1838a4af309a25d9c1e0cc1 (patch)
treeb9fa3b9b572b9fa720d7a3dc6ca3bfefda33a755 /main.go
parent6a0ce5ee4f4ffed70dbedce5590d1afc6c1e9b6c (diff)
fix summary url function
Diffstat (limited to 'main.go')
-rw-r--r--main.go8
1 files changed, 3 insertions, 5 deletions
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"
}
}