auto.setup, auto-blog.setup: Fix sanitization of entered wikiname. Closes: #547378
authorJoey Hess <joey@gnu.kitenet.net>
Wed, 23 Sep 2009 17:46:32 +0000 (13:46 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Wed, 23 Sep 2009 17:46:32 +0000 (13:46 -0400)
IkiWiki/Setup/Automator.pm
auto-blog.setup
auto.setup
debian/changelog

index 742d67666ba980d556bfc1b91128f77848b2c672..d1594d7ea4b09d034ef1d8e65d88996cf65e5042 100644 (file)
@@ -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}) {
index 3ef734b39a41a9213cccd4ec5e5f71f2aed2b3a2..cf77b3bf72c22bdcf5cc8375d25aebce77781a23 100644 (file)
@@ -15,6 +15,7 @@ require IkiWiki::Setup::Automator;
 
 our $wikiname=IkiWiki::Setup::Automator::ask(
        gettext("What will the blog be named?"), gettext("blog"));
+our $wikiname_short=IkiWiki::Setup::Automator::sanitize_wikiname($wikiname);
 our $rcs=IkiWiki::Setup::Automator::ask(
        gettext("What revision control system to use?"), "git");
 our $admin=IkiWiki::Setup::Automator::ask(
@@ -27,13 +28,13 @@ IkiWiki::Setup::Automator->import(
        wikiname => $wikiname,
        adminuser => [$admin],
        rcs => $rcs,
-       srcdir => "$ENV{HOME}/$wikiname",
-       destdir => "$ENV{HOME}/public_html/$wikiname",
-       repository => "$ENV{HOME}/$wikiname.".($rcs eq "monotone" ? "mtn" : $rcs),
-       dumpsetup => "$ENV{HOME}/$wikiname.setup",
-       url => "http://$domain/~$ENV{USER}/$wikiname",
-       cgiurl => "http://$domain/~$ENV{USER}/$wikiname/ikiwiki.cgi",
-       cgi_wrapper => "$ENV{HOME}/public_html/$wikiname/ikiwiki.cgi",
+       srcdir => "$ENV{HOME}/$wikiname_short",
+       destdir => "$ENV{HOME}/public_html/$wikiname_short",
+       repository => "$ENV{HOME}/$wikiname_short.".($rcs eq "monotone" ? "mtn" : $rcs),
+       dumpsetup => "$ENV{HOME}/$wikiname_short.setup",
+       url => "http://$domain/~$ENV{USER}/$wikiname_short",
+       cgiurl => "http://$domain/~$ENV{USER}/$wikiname_short/ikiwiki.cgi",
+       cgi_wrapper => "$ENV{HOME}/public_html/$wikiname_short/ikiwiki.cgi",
        adminemail => "$ENV{USER}\@$domain",
        add_plugins => [qw{goodstuff websetup comments blogspam}],
        disable_plugins => [qw{}],
index b3d2513d9ec7cd2903af8f8d0f7e27bca6d16535..dc2b19992ba8af2cbc232b997f0570c29d8a97a3 100644 (file)
@@ -14,6 +14,7 @@ require IkiWiki::Setup::Automator;
 
 our $wikiname=IkiWiki::Setup::Automator::ask(
        gettext("What will the wiki be named?"), gettext("wiki"));
+our $wikiname_short=IkiWiki::Setup::Automator::sanitize_wikiname($wikiname);
 our $rcs=IkiWiki::Setup::Automator::ask(
        gettext("What revision control system to use?"), "git");
 our $admin=IkiWiki::Setup::Automator::ask(
@@ -26,13 +27,13 @@ IkiWiki::Setup::Automator->import(
        wikiname => $wikiname,
        adminuser => [$admin],
        rcs => $rcs,
-       srcdir => "$ENV{HOME}/$wikiname",
-       destdir => "$ENV{HOME}/public_html/$wikiname",
-       repository => "$ENV{HOME}/$wikiname.".($rcs eq "monotone" ? "mtn" : $rcs),
-       dumpsetup => "$ENV{HOME}/$wikiname.setup",
-       url => "http://$domain/~$ENV{USER}/$wikiname",
-       cgiurl => "http://$domain/~$ENV{USER}/$wikiname/ikiwiki.cgi",
-       cgi_wrapper => "$ENV{HOME}/public_html/$wikiname/ikiwiki.cgi",
+       srcdir => "$ENV{HOME}/$wikiname_short",
+       destdir => "$ENV{HOME}/public_html/$wikiname_short",
+       repository => "$ENV{HOME}/$wikiname_short.".($rcs eq "monotone" ? "mtn" : $rcs),
+       dumpsetup => "$ENV{HOME}/$wikiname_short.setup",
+       url => "http://$domain/~$ENV{USER}/$wikiname_short",
+       cgiurl => "http://$domain/~$ENV{USER}/$wikiname_short/ikiwiki.cgi",
+       cgi_wrapper => "$ENV{HOME}/public_html/$wikiname_short/ikiwiki.cgi",
        adminemail => "$ENV{USER}\@$domain",
        add_plugins => [qw{goodstuff websetup}],
        disable_plugins => [qw{}],
index be7c97119132073a8c3567e9360fd1a7df206c47..bcdbd865c128aec8cb0c9f25fc5ef9bad46d824a 100644 (file)
@@ -14,6 +14,8 @@ ikiwiki (3.14159265) UNRELEASED; urgency=low
   * Updated Czech translation from Miroslav Kure. Closes: #546223
   * rsync: New plugin that allows pushing the destdir to a remote host
     via rsync or similar. Thanks, Amitai Schlair.
+  * auto.setup, auto-blog.setup: Fix sanitization of entered wikiname.
+    Closes: #547378
 
  -- Joey Hess <joeyh@debian.org>  Wed, 02 Sep 2009 15:01:27 -0400