Attachments are no longer lowercased like all other URLs.

This commit is contained in:
JT Smith 2002-06-18 01:14:07 +00:00
parent 3b8e6be358
commit 45e9b73e83
2 changed files with 14 additions and 6 deletions

View file

@ -428,7 +428,7 @@ sub save {
$_[0]->{_filename} =~ s/\./\_/g;
$_[0]->{_filename} .= ".txt";
}
$_[0]->{_filename} = WebGUI::URL::urlize($_[0]->getFilename);
$_[0]->{_filename} = WebGUI::URL::makeCompliant($_[0]->getFilename);
$_[0]->{_node}->create();
$file = FileHandle->new(">".$_[0]->getPath);
if (defined $file) {

View file

@ -46,6 +46,18 @@ sub gateway {
return $url;
}
#-------------------------------------------------------------------
sub makeCompliant {
my ($value);
$value = $_[0];
$value =~ s/\s+$//g; #removes trailing whitespace
$value =~ s/^\s+//g; #removes leading whitespace
$value =~ s/ /_/g; #replaces whitespace with underscores
$value =~ s/\.$//g; #removes trailing period
$value =~ s/[^A-Za-z0-9\-\.\_]//g; #removes all funky characters
return $value;
}
#-------------------------------------------------------------------
sub makeUnique {
my ($url, $test, $pageId);
@ -83,11 +95,7 @@ sub unescape {
sub urlize {
my ($value);
$value = lc($_[0]); #lower cases whole string
$value =~ s/\W+$//g; #removes trailing whitespace
$value =~ s/^\W+//g; #removes leading whitespace
$value =~ s/ /_/g; #replaces whitespace with underscores
$value =~ s/\.$//g; #removes trailing period
$value =~ s/[^a-z0-9\-\.\_]//g; #removes all funky characters
$value = makeCompliant($value);
return $value;
}