From 406e4a74469f551c3cbbb137181c1415dde050c9 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Sun, 9 Sep 2007 16:25:35 +0200 Subject: [PATCH] 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. --- lib/Packages/DoIndex.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; -- 2.39.2