diff options
-rw-r--r-- | lib/LXRng/Context.pm | 1 | ||||
-rw-r--r-- | lib/LXRng/Markup/File.pm | 2 | ||||
-rw-r--r-- | lib/LXRng/Repo/Git.pm | 2 | ||||
-rw-r--r-- | lib/LXRng/Repo/Git/Directory.pm | 2 | ||||
-rw-r--r-- | lib/LXRng/Repo/Git/Iterator.pm | 2 | ||||
-rw-r--r-- | lib/LXRng/Web.pm | 5 | ||||
-rwxr-xr-x | lxr-genxref | 9 |
7 files changed, 19 insertions, 4 deletions
diff --git a/lib/LXRng/Context.pm b/lib/LXRng/Context.pm index d316ede..bf717ab 100644 --- a/lib/LXRng/Context.pm +++ b/lib/LXRng/Context.pm @@ -43,6 +43,7 @@ sub new { my $path = $ENV{'REQUEST_URI'}; $path =~ s/\?.*//; $path =~ s,/+,/,g; + $path =~ s/%([0-9a-f][0-9a-f])/hex($1) >= 32 ? pack("C", hex($1)) : '_'/ge; $$self{'req_base'} = $host.$ENV{'SCRIPT_NAME'}; foreach my $p ($args{'query'}->param) { diff --git a/lib/LXRng/Markup/File.pm b/lib/LXRng/Markup/File.pm index 054463a..0d4b141 100644 --- a/lib/LXRng/Markup/File.pm +++ b/lib/LXRng/Markup/File.pm @@ -142,7 +142,7 @@ sub markupfile { return $$subst{$btype}->s($frag); } else { - return $frag; + return safe_html($frag); } } diff --git a/lib/LXRng/Repo/Git.pm b/lib/LXRng/Repo/Git.pm index 9e03f83..7407ca0 100644 --- a/lib/LXRng/Repo/Git.pm +++ b/lib/LXRng/Repo/Git.pm @@ -127,7 +127,7 @@ sub node { else { my $git = $self->_git_cmd('ls-tree', $release, $path); my ($mode, $gitpath); - ($mode, $type, $rev, $gitpath) = split(" ", <$git>); + ($mode, $type, $rev, $gitpath) = split(" ", <$git>, 4); } if ($type eq 'tree') { diff --git a/lib/LXRng/Repo/Git/Directory.pm b/lib/LXRng/Repo/Git/Directory.pm index 6b24214..cf46915 100644 --- a/lib/LXRng/Repo/Git/Directory.pm +++ b/lib/LXRng/Repo/Git/Directory.pm @@ -60,7 +60,7 @@ sub contents { my (@dirs, @files); while (<$git>) { chomp; - my ($mode, $type, $ref, $node) = split(" ", $_); + my ($mode, $type, $ref, $node) = split(" ", $_, 4); if ($type eq 'tree') { push(@dirs, LXRng::Repo::Git::Directory->new($$self{'repo'}, $prefix.$node, diff --git a/lib/LXRng/Repo/Git/Iterator.pm b/lib/LXRng/Repo/Git/Iterator.pm index 702b4ca..418142c 100644 --- a/lib/LXRng/Repo/Git/Iterator.pm +++ b/lib/LXRng/Repo/Git/Iterator.pm @@ -28,7 +28,7 @@ sub new { my @refs; my $git = $repo->_git_cmd('ls-tree', '-r', $release); while (<$git>) { - if (/\S+\s+blob\s+(\S+)\s+(\S+)/) { + if (/\S+\s+blob\s+(\S+)\s+(.+)/) { push(@refs, [$2, $1]); } } diff --git a/lib/LXRng/Web.pm b/lib/LXRng/Web.pm index a0846f3..9e9e24a 100644 --- a/lib/LXRng/Web.pm +++ b/lib/LXRng/Web.pm @@ -125,6 +125,11 @@ sub print_markedup_file { mkpath($cfile, 0, 0777); open($cache, '>', "$cfile/0"); } + else { + # Don't chunk file transfers unless cache is enabled. + $focus = 1; + } + my $handle = $node->handle(); LXRng::Lang->init($context); my $lang = LXRng::Lang->new($node); diff --git a/lxr-genxref b/lxr-genxref index 2e44091..f64fe78 100755 --- a/lxr-genxref +++ b/lxr-genxref @@ -280,10 +280,18 @@ sub reference_file($$$) { sub hash_file($$$) { my ($file, $fileid, $rels) = @_; + return 0 if $context->config->{'search_size_limit'} > 0 and + $file->size > $context->config->{'search_size_limit'}; + my $docid; if ($index->to_hash($fileid)) { my $handle; sysopen($handle, $file->phys_path, 0) || die($!); + unless (-T $handle) { + $handle->close(); + return 0; + } + warn("--- hashing ".$file->name." [".$file->revision."]\n"); my $doc = $hash->new_document($file->name); my $charset = $context->config->{'content_charset'} || []; @@ -313,6 +321,7 @@ sub hash_file($$$) { } else { $docid = $index->get_hashed_document($fileid); + return 0 unless $docid; my $doc = $hash->get_document($docid); if (reference_file($file, $fileid, $doc)) { $hash->save_document($docid, $doc); |