Merge branch 'master' of git.sv.gnu.org:/srv/git/oddmuse

This commit is contained in:
Alex Schroeder
2012-07-30 21:12:44 +02:00
2 changed files with 5 additions and 4 deletions

View File

@@ -218,6 +218,7 @@ sub TagFind {
my %page;
foreach my $tag (@tags) {
foreach my $id (split(/$FS/, $h{lc($tag)})) {
utf8::decode($id);
$page{$id} = 1;
}
}
@@ -248,9 +249,7 @@ sub NewTagGrepFiltered { # called within a lock!
}
# filter out the tags from the search string
$string = join(' ', grep(!/^-?tag:/, $string =~ /\"([^\"]+)\"|(\S+)/g));
# if no query terms remain, just return the pages we found
# return sort keys %page if $string eq '';
# otherwise run grep
# run the old code for any remaining search terms
return OldTagGrepFiltered($string, sort keys %page);
}

View File

@@ -2797,7 +2797,7 @@ sub ExpireKeepFiles { # call with opened page
sub ReadFile {
my $file = shift;
utf8::encode($file);
utf8::encode($file); # filenames are bytes!
if (open(IN, '<:encoding(UTF-8)', $file)) {
local $/ = undef; # Read complete files
my $data=<IN>;
@@ -3132,6 +3132,7 @@ sub DoDownload {
if @UploadTypes and not $allowed{$type};
print GetHttpHeader($type, $ts, undef, $encoding);
require MIME::Base64;
binmode(STDOUT, "raw");
print MIME::Base64::decode($data);
} else {
print GetHttpHeader('text/plain', $ts);
@@ -3370,6 +3371,7 @@ sub PageIsUploadedFile {
return undef if $OpenPageName eq $id;
if ($IndexHash{$id}) {
my $file = GetPageFile($id);
utf8::encode($file); # filenames are bytes!
open(FILE, '<:encoding(UTF-8)', $file)
or ReportError(Ts('Cannot open %s', $file) . ": $!", '500 INTERNAL SERVER ERROR');
while (defined($_ = <FILE>) and $_ !~ /^text: /) {