Print Verbatim Onecapitaltopic

Testing Bugs.Item2979

sub sanitizeAttachmentName {
    my $fileName = shift;
    # homegrown split because File::Spec functions will assume that directory path is using / in UNIX and \ in Windows as defined in the HOST environment.
    # And we don't know the client OS. Problem is specific to IE which sends the full original client path when you upload files. See Item2859 and Item2225 before
    # trying again to use File::Spec functions and remember to test with IE. Cut path from filepath name (Windows '\' and Unix "/" format)
    my @pathz = ( split( /\\/, $fileName ) );
    my $filetemp = $pathz[$#pathz];
    my @pathza = ( split( '/', $filetemp ) );
    $filetemp = $pathza[$#pathza];
    # untaint
    $fileName = untaintUnchecked($filetemp);
    my $origName = $fileName;
    # Change spaces to underscore
    $fileName =~ s/ /_/go;
    # Remove problematic chars
    $fileName =~ s/$TWiki::cfg{NameFilter}//goi;
    # Append .txt to some files
    $fileName =~ s/$TWiki::cfg{UploadFilter}/$1\.txt/goi;
    return ($fileName, $origName);
}
sub sanitizeAttachmentName {
    my $fileName = shift;
    # homegrown split because File::Spec functions will assume that directory path is using / in UNIX and \ in Windows as defined in the HOST environment.
    # And we don't know the client OS. Problem is specific to IE which sends the full original client path when you upload files. See Item2859 and Item2225 before
    # trying again to use File::Spec functions and remember to test with IE. Cut path from filepath name (Windows '\' and Unix "/" format)
    my @pathz = ( split( /\\/, $fileName ) );
    my $filetemp = $pathz[$#pathz];
    my @pathza = ( split( '/', $filetemp ) );
    $filetemp = $pathza[$#pathza];
    # untaint
    $fileName = untaintUnchecked($filetemp);
    my $origName = $fileName;
    # Change spaces to underscore
    $fileName =~ s/ /_/go;
    # Remove problematic chars
    $fileName =~ s/$TWiki::cfg{NameFilter}//goi;
    # Append .txt to some files
    $fileName =~ s/$TWiki::cfg{UploadFilter}/$1\.txt/goi;
    return ($fileName, $origName);
}
sub sanitizeAttachmentName {
    my $fileName = shift;
    # homegrown split because File::Spec functions will assume that directory path is using / in UNIX and \ in Windows as defined in the HOST environment.
    # And we don't know the client OS. Problem is specific to IE which sends the full original client path when you upload files. See Item2859 and Item2225 before
    # trying again to use File::Spec functions and remember to test with IE. Cut path from filepath name (Windows '\' and Unix "/" format)
    my @pathz = ( split( /\\/, $fileName ) );
    my $filetemp = $pathz[$#pathz];
    my @pathza = ( split( '/', $filetemp ) );
    $filetemp = $pathza[$#pathza];
    # untaint
    $fileName = untaintUnchecked($filetemp);
    my $origName = $fileName;
    # Change spaces to underscore
    $fileName =~ s/ /_/go;
    # Remove problematic chars
    $fileName =~ s/$TWiki::cfg{NameFilter}//goi;
    # Append .txt to some files
    $fileName =~ s/$TWiki::cfg{UploadFilter}/$1\.txt/goi;
    return ($fileName, $origName);
}
sub sanitizeAttachmentName {
    my $fileName = shift;
    # homegrown split because File::Spec functions will assume that directory path is using / in UNIX and \ in Windows as defined in the HOST environment.
    # And we don't know the client OS. Problem is specific to IE which sends the full original client path when you upload files. See Item2859 and Item2225 before
    # trying again to use File::Spec functions and remember to test with IE. Cut path from filepath name (Windows '\' and Unix "/" format)
    my @pathz = ( split( /\\/, $fileName ) );
    my $filetemp = $pathz[$#pathz];
    my @pathza = ( split( '/', $filetemp ) );
    $filetemp = $pathza[$#pathza];
    # untaint
    $fileName = untaintUnchecked($filetemp);
    my $origName = $fileName;
    # Change spaces to underscore
    $fileName =~ s/ /_/go;
    # Remove problematic chars
    $fileName =~ s/$TWiki::cfg{NameFilter}//goi;
    # Append .txt to some files
    $fileName =~ s/$TWiki::cfg{UploadFilter}/$1\.txt/goi;
    return ($fileName, $origName);
}
sub sanitizeAttachmentName {
    my $fileName = shift;
    # homegrown split because File::Spec functions will assume that directory path is using / in UNIX and \ in Windows as defined in the HOST environment.
    # And we don't know the client OS. Problem is specific to IE which sends the full original client path when you upload files. See Item2859 and Item2225 before
    # trying again to use File::Spec functions and remember to test with IE. Cut path from filepath name (Windows '\' and Unix "/" format)
    my @pathz = ( split( /\\/, $fileName ) );
    my $filetemp = $pathz[$#pathz];
    my @pathza = ( split( '/', $filetemp ) );
    $filetemp = $pathza[$#pathza];
    # untaint
    $fileName = untaintUnchecked($filetemp);
    my $origName = $fileName;
    # Change spaces to underscore
    $fileName =~ s/ /_/go;
    # Remove problematic chars
    $fileName =~ s/$TWiki::cfg{NameFilter}//goi;
    # Append .txt to some files
    $fileName =~ s/$TWiki::cfg{UploadFilter}/$1\.txt/goi;
    return ($fileName, $origName);
}
sub sanitizeAttachmentName {
    my $fileName = shift;
    # homegrown split because File::Spec functions will assume that directory path is using / in UNIX and \ in Windows as defined in the HOST environment.
    # And we don't know the client OS. Problem is specific to IE which sends the full original client path when you upload files. See Item2859 and Item2225 before
    # trying again to use File::Spec functions and remember to test with IE. Cut path from filepath name (Windows '\' and Unix "/" format)
    my @pathz = ( split( /\\/, $fileName ) );
    my $filetemp = $pathz[$#pathz];
    my @pathza = ( split( '/', $filetemp ) );
    $filetemp = $pathza[$#pathza];
    # untaint
    $fileName = untaintUnchecked($filetemp);
    my $origName = $fileName;
    # Change spaces to underscore
    $fileName =~ s/ /_/go;
    # Remove problematic chars
    $fileName =~ s/$TWiki::cfg{NameFilter}//goi;
    # Append .txt to some files
    $fileName =~ s/$TWiki::cfg{UploadFilter}/$1\.txt/goi;
    return ($fileName, $origName);
}
sub sanitizeAttachmentName {
    my $fileName = shift;
    # homegrown split because File::Spec functions will assume that directory path is using / in UNIX and \ in Windows as defined in the HOST environment.
    # And we don't know the client OS. Problem is specific to IE which sends the full original client path when you upload files. See Item2859 and Item2225 before
    # trying again to use File::Spec functions and remember to test with IE. Cut path from filepath name (Windows '\' and Unix "/" format)
    my @pathz = ( split( /\\/, $fileName ) );
    my $filetemp = $pathz[$#pathz];
    my @pathza = ( split( '/', $filetemp ) );
    $filetemp = $pathza[$#pathza];
    # untaint
    $fileName = untaintUnchecked($filetemp);
    my $origName = $fileName;
    # Change spaces to underscore
    $fileName =~ s/ /_/go;
    # Remove problematic chars
    $fileName =~ s/$TWiki::cfg{NameFilter}//goi;
    # Append .txt to some files
    $fileName =~ s/$TWiki::cfg{UploadFilter}/$1\.txt/goi;
    return ($fileName, $origName);
}
THIS IS THE END OF THE VERBATIM BLOCK

-- PeterThoeny - 20 Oct 2006

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r4 - 2007-01-03 - KennethLavrsen
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback