forked from github/kensanata.oddmuse
Merge branch 'master' of git.sv.gnu.org:/srv/git/oddmuse
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
4
wiki.pl
4
wiki.pl
@@ -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: /) {
|
||||
|
||||
Reference in New Issue
Block a user