- URLs that would have been created like page.html/article.html are now
created like page/article.html to make them look more realistic.
This commit is contained in:
parent
f43fb782f4
commit
cc569b1b4d
2 changed files with 18 additions and 0 deletions
|
|
@ -12,6 +12,8 @@
|
|||
- Fixed a problem with JSON formatting in spectre config transaction.
|
||||
- Changed Manage Revisions screen to order revisions by descending revision
|
||||
date.
|
||||
- URLs that would have been created like page.html/article.html are now
|
||||
created like page/article.html to make them look more realistic.
|
||||
- fix: Fixing bad link on the Event page to the search engine. Added a new
|
||||
Event template variable called urlSearch to handle it. (perlDreamer Consulting, LLC)
|
||||
- fix: Set default groupIdEditEvent to groupIdEdit during upgrade (perlDreamer Consulting, LLC)
|
||||
|
|
|
|||
|
|
@ -385,12 +385,17 @@ Any text string. Most likely will have been the Asset's name or title.
|
|||
sub fixUrl {
|
||||
my $self = shift;
|
||||
my $url = shift;
|
||||
|
||||
# build a URL from the parent
|
||||
unless ($url) {
|
||||
$url = $self->getParent->get("url");
|
||||
$url =~ s/(.*)\..*/$1/;
|
||||
$url .= '/'.$self->getValue("menuTitle");
|
||||
}
|
||||
$url = $self->session->url->urlize($url);
|
||||
|
||||
# fix urls used by uploads and extras
|
||||
# and those beginning with http
|
||||
my @badUrls = ($self->session->config->get("extrasURL"), $self->session->config->get("uploadsURL"));
|
||||
foreach my $badUrl (@badUrls) {
|
||||
if ($badUrl =~ /^http/) {
|
||||
|
|
@ -402,15 +407,26 @@ sub fixUrl {
|
|||
$url = "_".$url;
|
||||
}
|
||||
}
|
||||
|
||||
# urls can't be longer than 250 characters
|
||||
if (length($url) > 250) {
|
||||
$url = substr($url,220);
|
||||
}
|
||||
|
||||
# remove multiple extensions from the url if there are some
|
||||
while ($url =~ m{^(.*)\.\w+(/.*)$}) {
|
||||
$url =~ s{^(.*)\.\w+(/.*)$}{$1$2}ig;
|
||||
}
|
||||
|
||||
# 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
|
||||
&& !($url =~ /\./) #don't add an extension of the url already contains a dot
|
||||
&& $self->get("url") eq $self->getId # only add it if we're creating a new url
|
||||
) {
|
||||
$url .= ".".$self->session->setting->get("urlExtension");
|
||||
}
|
||||
|
||||
# check to see if the url already exists or not, and increment it if it does
|
||||
if ($self->urlExists($self->session, $url, {assetId=>$self->getId})) {
|
||||
my @parts = split(/\./,$url);
|
||||
if ($parts[0] =~ /(.*)(\d+$)/) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue