summaryrefslogtreecommitdiff
path: root/IkiWiki/Setup
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-09-23 13:46:32 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-09-23 13:46:32 -0400
commit01a9a12bbfbc21b45c59e4bbc52fbf488776d386 (patch)
tree555250ed683d39520ea1dd4f9d3515c48f1826c1 /IkiWiki/Setup
parent82ad4f57d67fa6a210436621dcb72404a099da8a (diff)
auto.setup, auto-blog.setup: Fix sanitization of entered wikiname. Closes: #547378
Diffstat (limited to 'IkiWiki/Setup')
-rw-r--r--IkiWiki/Setup/Automator.pm15
1 files changed, 10 insertions, 5 deletions
diff --git a/IkiWiki/Setup/Automator.pm b/IkiWiki/Setup/Automator.pm
index 742d67666..d1594d7ea 100644
--- a/IkiWiki/Setup/Automator.pm
+++ b/IkiWiki/Setup/Automator.pm
@@ -24,15 +24,20 @@ sub prettydir ($) {
return $dir;
}
-sub import (@) {
- my $this=shift;
- IkiWiki::Setup::merge({@_});
+sub sanitize_wikiname ($) {
+ my $wikiname=shift;
# Sanitize this to avoid problimatic directory names.
- $config{wikiname}=~s/[^-A-Za-z0-9_]//g;
- if (! length $config{wikiname}) {
+ $wikiname=~s/[^-A-Za-z0-9_]//g;
+ if (! length $wikiname) {
error gettext("you must enter a wikiname (that contains alphanumerics)");
}
+ return $wikiname;
+}
+
+sub import (@) {
+ my $this=shift;
+ IkiWiki::Setup::merge({@_});
# Avoid overwriting any existing files.
foreach my $key (qw{srcdir destdir repository dumpsetup}) {