check format of collection name in `raco link'

This commit is contained in:
Matthew Flatt 2011-08-24 17:13:22 -06:00
parent 84e3ab2a20
commit 7299b0603e

View File

@ -15,6 +15,15 @@
#:show? [show? #f] #:show? [show? #f]
#:repair? [repair? #f] #:repair? [repair? #f]
. dirs) . dirs)
(define (check-name name)
(unless (and (regexp-match #rx"^[a-zA-z+_%-]+$" name)
(module-path? name))
(error 'links "name is not valid as a top-level collection name: ~e"
name)))
(when name
(check-name name))
(define file (or in-file (define file (or in-file
(if user? (if user?
(find-system-path 'links-file) (find-system-path 'links-file)
@ -136,6 +145,8 @@
(if (member (cdr e) l) (if (member (cdr e) l)
table table
(let () (let ()
(when (string? a-name)
(check-name a-name))
(add-entry! e) (add-entry! e)
(cons e table))))))))) (cons e table)))))))))