aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-10-01 14:43:28 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-10-01 14:43:28 -0400
commit826af4600a4e413ca8ec7b6d56f0a1cdca0ad635 (patch)
tree5e95180d5b63f028ad019d19a9dba84e65e44cf9 /IkiWiki
parent82eac2d04eb9a3a2e52972a0219606ac292ee3b9 (diff)
downloadikiwiki-826af4600a4e413ca8ec7b6d56f0a1cdca0ad635.tar
ikiwiki-826af4600a4e413ca8ec7b6d56f0a1cdca0ad635.tar.gz
fix subpage rename bug with indexpages
If indexpages is enabled, then foo/index.mdwn will look like a subpage of foo, so an additional check is needed to avoid trying to rename it twice.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/rename.pm26
1 files changed, 15 insertions, 11 deletions
diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm
index 218cab489..6c131487a 100644
--- a/IkiWiki/Plugin/rename.pm
+++ b/IkiWiki/Plugin/rename.pm
@@ -292,17 +292,21 @@ sub sessioncgi ($$) { #{{{
# See if any subpages need to be renamed.
if ($q->param("subpages") && $src ne $dest) {
foreach my $p (keys %pagesources) {
- if ($pagesources{$p}=~m/^\Q$src\E\//) {
- my $d=$pagesources{$p};
- $d=~s/^\Q$src\E\//$dest\//;
- push @torename, {
- src => $p,
- srcfile => $pagesources{$p},
- dest => pagename($d),
- destfile => $d,
- required => 0,
- };
- }
+ next unless $pagesources{$p}=~m/^\Q$src\E\//;
+ # If indexpages is enabled, the
+ # srcfile should not be confused
+ # with a subpage.
+ next if $pagesources{$p} eq $srcfile;
+
+ my $d=$pagesources{$p};
+ $d=~s/^\Q$src\E\//$dest\//;
+ push @torename, {
+ src => $p,
+ srcfile => $pagesources{$p},
+ dest => pagename($d),
+ destfile => $d,
+ required => 0,
+ };
}
}