From: Alf Høgemark Date: Wed, 5 Feb 2014 19:02:44 +0000 (+0100) Subject: updxlrator: Handle colon in filenames in updatexlrator.cgi X-Git-Url: http://git.ipfire.org/?p=people%2Fteissler%2Fipfire-2.x.git;a=commitdiff_plain;h=5e4262245e8166717b7d44dedebbf1c903d03181 updxlrator: Handle colon in filenames in updatexlrator.cgi The updatexlrator.cgi is assuming that colon is not part of any filenames downloaded by updxlrator. Fix this by fixing regular expression used for listing pending download files, and by fixing regular expression used to listing files in maintenance view. The fix for listing in maintenance is not very nice, I just use ":separator:" as field separator instead of just ":", which was used earlier. This should make it very unlikely to collide with a part of the filename. Also make the files in download be sorted using lower case, like it is done for files in the vendor path. The problem can be reproduced by downloading http://mirror.us.leaseweb.net/archlinux/community/os/x86_64/ docker-1:0.7.6-1-x86_64.pkg.tar.xz, after pkg.tar.xz files support has been added to updxlrator. --- diff --git a/html/cgi-bin/updatexlrator.cgi b/html/cgi-bin/updatexlrator.cgi index df77a86af..6cd9668db 100644 --- a/html/cgi-bin/updatexlrator.cgi +++ b/html/cgi-bin/updatexlrator.cgi @@ -517,7 +517,7 @@ END $id = 0; foreach $updatefile (@downloadfiles) { - $updatefile =~ s/.*://; + $updatefile =~ s/.*:download/download/; my $size_updatefile = 0; my $mtime = 0; if(-e "$repository/$updatefile") { @@ -971,7 +971,8 @@ foreach (@sources) { next if(/\.info$/); $updatefile = substr($_,rindex($_,"/")+1); - $updatefile .= ":download/$vendorid/$updatefile"; + $_ = $updatefile; tr/[A-Z]/[a-z]/; + $updatefile = "$_:separator:download/$vendorid/$updatefile"; $updatefile = " ".$updatefile; push(@repositoryfiles,$updatefile); } @@ -1002,7 +1003,7 @@ foreach (@sources) chomp($sourceurl); $updatefile = substr($sourceurl,rindex($sourceurl,'/')+1,length($sourceurl)); $_ = $updatefile; tr/[A-Z]/[a-z]/; - $updatefile = "$_:$vendorid/$uuid/$updatefile"; + $updatefile = "$_:separator:$vendorid/$uuid/$updatefile"; push(@repositoryfiles,$updatefile); } } @@ -1145,7 +1146,7 @@ END $id = 0; foreach $updatefile (@files) { - $updatefile =~ s/.*://; + $updatefile =~ s/.*:separator://; my $size_updatefile = 0; my $mtime = 0; if(-e "$repository/$updatefile") {