getKeywordStaticURL function, with tests.
This commit is contained in:
parent
f9e3c0c99c
commit
32ef0d5068
2 changed files with 47 additions and 13 deletions
|
|
@ -357,15 +357,27 @@ sub getKeywordFilename {
|
|||
Returns the whole URL for the file containing stories that match this keyword. Used
|
||||
in exportAssetCollateral.
|
||||
|
||||
The goal of this method is to create a "safe" URL where all the keyword files can
|
||||
reside with no clashes. The best place is based on the URL for the StoryArchive.
|
||||
|
||||
=head3 $keyword
|
||||
|
||||
The keyword to generate a URL for.
|
||||
Generates a specific URL for $keyword.
|
||||
|
||||
=cut
|
||||
|
||||
sub getKeywordStaticURL {
|
||||
my ($self,$keyword) = @_;
|
||||
return join '/', $self->getUrl, $self->getKeywordFilename($keyword);
|
||||
my $url = $self->getUrl;
|
||||
my @parts = split /\//, $url;
|
||||
my $lastPart = pop @parts;
|
||||
if (index $lastPart, '.' == -1) {
|
||||
return join '/', $self->getUrl, $self->getKeywordFilename($keyword);
|
||||
}
|
||||
else {
|
||||
$lastPart =~ s/\.[^.]*$//;
|
||||
return join '/', @parts, $lastPart, $self->getKeywordFilename($keyword);
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue