aboutsummaryrefslogtreecommitdiff
path: root/backend/db
diff options
context:
space:
mode:
authorRyan Mehri <[email protected]>2020-05-12 09:29:49 -0600
committerGitHub <[email protected]>2020-05-12 09:29:49 -0600
commitc0fc08d77570232cfda3f6e2bdbac2c3bf1aafeb (patch)
tree9463f3be987993bda22ef4bfc3a56c9174fceee8 /backend/db
parentMerge pull request #17 from jackyzha0/password (diff)
parentworking no pass rendering (diff)
downloadctrl-v-c0fc08d77570232cfda3f6e2bdbac2c3bf1aafeb.tar.xz
ctrl-v-c0fc08d77570232cfda3f6e2bdbac2c3bf1aafeb.zip
Merge pull request #18 from jackyzha0/no-pass-rendering
no password paste rendering
Diffstat (limited to 'backend/db')
-rw-r--r--backend/db/db.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/backend/db/db.go b/backend/db/db.go
index fba7bd9..4e58188 100644
--- a/backend/db/db.go
+++ b/backend/db/db.go
@@ -82,16 +82,11 @@ func New(ip, content, expiry, title, password string) (string, error) {
}
func checkLengths(title string, content string) error {
- errs := ""
if len(title) > TitleLimit {
- errs += fmt.Sprintf("title is longer than character limit of %d\n", TitleLimit)
+ return fmt.Errorf("title is longer than character limit of %d\n", TitleLimit)
}
if len(content) > ContentLimit {
- errs += fmt.Sprintf("content is longer than character limit of %d\n", ContentLimit)
- }
- // if any errors were found
- if errs != "" {
- return fmt.Errorf(errs)
+ return fmt.Errorf("content is longer than character limit of %d\n", ContentLimit)
}
return nil