]> git.deb.at Git - deb/packages.git/commitdiff
Packages::DoIndex: Ugly hack to fix content negotiation
authorFrank Lichtenheld <frank@lichtenheld.de>
Sun, 9 Sep 2007 14:25:35 +0000 (16:25 +0200)
committerFrank Lichtenheld <frank@lichtenheld.de>
Sun, 9 Sep 2007 14:25:35 +0000 (16:25 +0200)
Since we don't create the static pages for ddtplangs currently,
only for polangs, but we don't discriminate between the two in
the content negotiation we might try to serve a non-existant file.

Fixing the content negoation or the static file generation will
take some time and testing. For now, work around the bug by stat'ing
the requested file in DoIndex and falling back to English in case it doesn't
exist.

lib/Packages/DoIndex.pm

index 0c5d89dfa57ef48a618b0e423facb5e115843236..45a5b494bf8a7ba16da24b9a0a1b0093590190c9 100644 (file)
@@ -46,7 +46,12 @@ sub send_file {
     $path .= "$opts->{priority}[0]/" if @{$opts->{priority}};
     # we don't have translated index pages for subsections yet
     $opts->{lang} = 'en' if @{$opts->{subsection}} or $file eq 'allpackages';
     $path .= "$opts->{priority}[0]/" if @{$opts->{priority}};
     # we don't have translated index pages for subsections yet
     $opts->{lang} = 'en' if @{$opts->{subsection}} or $file eq 'allpackages';
-    $path .= "$file.$opts->{lang}.$opts->{format}";
+
+    #FIXME: ugly hack
+    if ($opts->{lang} ne 'en' and !-f "$wwwdir/$path$file.$opts->{lang}.$opts->{format}") {
+       $opts->{lang} = 'en';
+    }
+    $path .= "$file.$opts->{lang}.$opts->{format}";    
 
     unless (@Packages::CGI::fatal_errors) {
        my $buffer;
 
     unless (@Packages::CGI::fatal_errors) {
        my $buffer;