($path,$fn) = $path_file =~ m!^$datadir/(?:(.*)/)?(.*)\.$file_extension!;
# Only stories in the right hierarchy
- $path =~ /^$currentdir(?=$|\/)/ or $path_file eq "$datadir/$currentdir" or next;
+ $path =~ /^$currentdir/ or $path_file eq "$datadir/$currentdir" or next;
# Prepend a slash for use in templates only if a path exists
$path &&= "/$path";