]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
updxlrator: Handle colon in filenames in updatexlrator.cgi
authorAlf Høgemark <alf@i100.no>
Wed, 5 Feb 2014 19:02:44 +0000 (20:02 +0100)
committerAlf Høgemark <alf@i100.no>
Sat, 15 Feb 2014 14:03:45 +0000 (15:03 +0100)
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.

html/cgi-bin/updatexlrator.cgi

index df77a86afdb2e690464d0b3d23b96821a7631bca..6cd9668db893ccee7162c3747eeeb07c83f3cb4f 100644 (file)
@@ -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") {