Add tests to cover the removal of extensions in the "directory"
parts of the path. Refactor out the while loop with match and nested s/// into a single regexp.
This commit is contained in:
parent
cda571c3ef
commit
b70ef9d23a
2 changed files with 11 additions and 4 deletions
|
|
@ -583,9 +583,10 @@ sub fixUrl {
|
|||
}
|
||||
|
||||
# remove multiple extensions from the url if there are some
|
||||
while ($url =~ m{^(.*)\.\w+(/.*)$}) {
|
||||
$url =~ s{^(.*)\.\w+(/.*)$}{$1$2}ig;
|
||||
}
|
||||
$url =~ s{
|
||||
(\.\w+)* # Strip off any number of extensions
|
||||
(?=/) # Followed by a slash
|
||||
}{}xg; # And delete all of them in the string
|
||||
|
||||
# add automatic extension if we're supposed to
|
||||
if ($self->session->setting->get("urlExtension") ne "" #don't add an extension if one isn't set
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue