Check for empty version number
This commit is contained in:
parent
4070a9f0ba
commit
e9f9b6a303
2
TODO.md
2
TODO.md
|
@ -13,8 +13,6 @@ you should be able to specify git repos over http/https
|
|||
you should be able to specify subdirs in git repos
|
||||
you should check the existence of repos/github repos/urls/etc via XHR
|
||||
|
||||
don't let people enter blank version numbers
|
||||
|
||||
Much more input validation is needed
|
||||
|
||||
## Design possibilities
|
||||
|
|
16
src/main.rkt
16
src/main.rkt
|
@ -908,12 +908,16 @@
|
|||
;; Right up there with "parse error".
|
||||
draft))]
|
||||
["add_version"
|
||||
(if (assoc new_version (draft-package-versions draft))
|
||||
(package-form (format "Could not add version ~a, as it already exists." new_version)
|
||||
draft)
|
||||
(package-form #f (struct-copy draft-package draft
|
||||
[versions (cons (list new_version default-empty-source-url)
|
||||
(draft-package-versions draft))])))]
|
||||
(cond
|
||||
[(equal? (string-trim new_version) "")
|
||||
(package-form "Please enter a version number to add." draft)]
|
||||
[(assoc new_version (draft-package-versions draft))
|
||||
(package-form (format "Could not add version ~a, as it already exists." new_version)
|
||||
draft)]
|
||||
[else
|
||||
(package-form #f (struct-copy draft-package draft
|
||||
[versions (cons (list new_version default-empty-source-url)
|
||||
(draft-package-versions draft))]))])]
|
||||
[(regexp #px"^version__(.*)__delete$" (list _ version))
|
||||
(package-form #f (struct-copy draft-package draft
|
||||
[versions (filter (lambda (v)
|
||||
|
|
Loading…
Reference in New Issue
Block a user