* In the aggregator, check for and deal with post filenames that are
[ikiwiki.git] / IkiWiki / Plugin / aggregate.pm
index 964ef4b4b282b829f5231f224e6ebfb9160e95eb..d11283f0a4fb113ccb5c444a44f727ab40d83eb3 100644 (file)
@@ -310,6 +310,20 @@ sub add_page (@) { #{{{
                       -e pagefile($page.$c)) {
                        $c++
                }
+
+               # Make sure that the file name isn't too long. 
+               # NB: This doesn't check for path length limits.
+               eval q{use POSIX};
+               my $max=POSIX::pathconf($config{srcdir}, &POSIX::_PC_NAME_MAX);
+               if (defined $max && length(htmlpage($page)) >= $max) {
+                       $c="";
+                       $page="item";
+                       while (exists $IkiWiki::pagecase{lc $page.$c} ||
+                              -e pagefile($page.$c)) {
+                               $c++
+                       }
+               }
+
                $guid->{page}=$page;
                debug(sprintf(gettext("creating new page %s"), $page));
        }