mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 08:40:24 +00:00
Fix to always download altered file (no banner)
This commit is contained in:
1
lang/en
1
lang/en
@@ -307,7 +307,6 @@ ui_paging=Showing rows $1 to $2 of $3
|
||||
ui_rowlabel=$2 in row $1 :
|
||||
ui_filterbox=Type to filter..
|
||||
ui_of=of
|
||||
ui_jsblocked=JavaScript was removed to protect your privacy!
|
||||
|
||||
header_statusmsg=$1 logged into $2 $3 on $4 ($5)
|
||||
|
||||
|
||||
@@ -94,40 +94,13 @@ if ($ENV{'PATH_INFO'}) {
|
||||
while(read(FILE, $buffer, $bsize)) {
|
||||
if ($dangertypes) {
|
||||
my $buffer_filtered = &filter_javascript($buffer, $pdftype);
|
||||
# If content was changed upon filtering
|
||||
# If content was changed upon
|
||||
# filtering force download it
|
||||
if ($buffer_filtered ne $buffer) {
|
||||
# For text simply return filtered but
|
||||
# tell user that it was filtered out
|
||||
if ($htmltype) {
|
||||
# Add a banner showing content was changed
|
||||
my $prefdata =
|
||||
&ui_alert_box($text{'ui_jsblocked'}, 'danger');
|
||||
# Pass filtered content with the banner
|
||||
# Insert the banner in HTML body
|
||||
if ($buffer_filtered =~ s/(<body.*?>)/$1$prefdata/) {
|
||||
$fdata = $buffer_filtered;
|
||||
}
|
||||
else {
|
||||
# Insert the banner to the top of HTML doc
|
||||
$fdata = "$prefdata$buffer_filtered";
|
||||
}
|
||||
# Update content length
|
||||
$fsize = length($fdata);
|
||||
}
|
||||
# For no text files simply force
|
||||
# download if file was altered
|
||||
else {
|
||||
# Force send it
|
||||
$type = "application/octet-stream";
|
||||
print "Content-Disposition: Attachment\n";
|
||||
# Pass original content
|
||||
$fdata = $buffer;
|
||||
}
|
||||
}
|
||||
# Buffere was not changed, just pass it as is
|
||||
else {
|
||||
$fdata = $buffer;
|
||||
$type = "application/octet-stream";
|
||||
print "Content-Disposition: Attachment\n";
|
||||
}
|
||||
$fdata = $buffer;
|
||||
}
|
||||
else {
|
||||
$fdata .= $buffer;
|
||||
|
||||
Reference in New Issue
Block a user