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 be able to specify subdirs in git repos
|
||||||
you should check the existence of repos/github repos/urls/etc via XHR
|
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
|
Much more input validation is needed
|
||||||
|
|
||||||
## Design possibilities
|
## Design possibilities
|
||||||
|
|
10
src/main.rkt
10
src/main.rkt
|
@ -908,12 +908,16 @@
|
||||||
;; Right up there with "parse error".
|
;; Right up there with "parse error".
|
||||||
draft))]
|
draft))]
|
||||||
["add_version"
|
["add_version"
|
||||||
(if (assoc new_version (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)
|
(package-form (format "Could not add version ~a, as it already exists." new_version)
|
||||||
draft)
|
draft)]
|
||||||
|
[else
|
||||||
(package-form #f (struct-copy draft-package draft
|
(package-form #f (struct-copy draft-package draft
|
||||||
[versions (cons (list new_version default-empty-source-url)
|
[versions (cons (list new_version default-empty-source-url)
|
||||||
(draft-package-versions draft))])))]
|
(draft-package-versions draft))]))])]
|
||||||
[(regexp #px"^version__(.*)__delete$" (list _ version))
|
[(regexp #px"^version__(.*)__delete$" (list _ version))
|
||||||
(package-form #f (struct-copy draft-package draft
|
(package-form #f (struct-copy draft-package draft
|
||||||
[versions (filter (lambda (v)
|
[versions (filter (lambda (v)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user