From: Frank Lichtenheld Date: Sun, 9 Sep 2007 14:25:35 +0000 (+0200) Subject: Packages::DoIndex: Ugly hack to fix content negotiation X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=406e4a74469f551c3cbbb137181c1415dde050c9;p=deb%2Fpackages.git Packages::DoIndex: Ugly hack to fix content negotiation 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. --- diff --git a/lib/Packages/DoIndex.pm b/lib/Packages/DoIndex.pm index 0c5d89d..45a5b49 100644 --- a/lib/Packages/DoIndex.pm +++ b/lib/Packages/DoIndex.pm @@ -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 .= "$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;