--- loncom/lonnet/perl/lonnet.pm 2007/01/25 21:09:24 1.830 +++ loncom/lonnet/perl/lonnet.pm 2007/01/29 21:16:55 1.831 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.830 2007/01/25 21:09:24 albertel Exp $ +# $Id: lonnet.pm,v 1.831 2007/01/29 21:16:55 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1451,15 +1451,17 @@ sub store_edited_file { } sub clean_filename { - my ($fname)=@_; + my ($fname,$args)=@_; # Replace Windows backslashes by forward slashes $fname=~s/\\/\//g; -# Get rid of everything but the actual filename - $fname=~s/^.*\/([^\/]+)$/$1/; + if (!$args->{'keep_path'}) { + # Get rid of everything but the actual filename + $fname=~s/^.*\/([^\/]+)$/$1/; + } # Replace spaces by underscores $fname=~s/\s+/\_/g; # Replace all other weird characters by nothing - $fname=~s/[^\w\.\-]//g; + $fname=~s{[^/\w\.\-]}{}g; # Replace all .\d. sequences with _\d. so they no longer look like version # numbers $fname=~s/\.(\d+)(?=\.)/_$1/g;