summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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,
+ };
}
}