Permalink
Browse files

Fix up disposition type in attachments for http_send()

  • Loading branch information...
1 parent 581413c commit 9ca7190fc09a04f647823803c9ccd4a521bb2765 @pudge pudge committed Feb 8, 2005
Showing with 14 additions and 2 deletions.
  1. +5 −1 Slash/Utility/Anchor/Anchor.pm
  2. +1 −0 Slash/XML/XML.pm
  3. +5 −0 plugins/Blob/blob.pl
  4. +1 −0 plugins/PubKey/pubkey.pl
  5. +2 −1 plugins/Stats/stats.pl
@@ -280,7 +280,11 @@ sub http_send {
if ($opt->{filename}) {
$opt->{filename} =~ s/[^\w_.-]/_/g;
my $val = "filename=$opt->{filename}";
- $val = "attachment; $val" if $opt->{attachment};
+ # none by default, MSIE etc. had problems?
+ if ($opt->{dis_type}) {
+ $opt->{dis_type} =~ s/\W+//;
+ $val = "$opt->{dis_type}; $val";
+ }
$r->header_out('Content-Disposition', $val);
}
View
@@ -146,6 +146,7 @@ sub xmlDisplay {
content_type => 'text/xml',
filename => $opt->{filename},
etag => md5_hex($temp),
+ dis_type => 'inline',
content => $content
});
}
@@ -32,6 +32,11 @@ sub main {
content_type => $data->{content_type},
filename => $data->{filename},
do_etag => 1,
+ dis_type => 'inline', # best to default to inline,
+ # users can choose to download
+ # if they wish, and most file
+ # types will auto-download anyway,
+ # even if set to inline
content => $data->{data}
});
}
@@ -31,6 +31,7 @@ sub main {
content_type => 'text/plain',
filename => "pubkey-$uid.asc",
do_etag => 1,
+ dis_type => 'inline',
content => $content
});
}
@@ -154,8 +154,8 @@ sub csv {
http_send({
content_type => 'text/csv',
filename => $filename,
- attachment => 1,
do_etag => 1,
+ dis_type => 'attachment',
content => $content
});
}
@@ -198,6 +198,7 @@ sub graph {
content_type => $type,
filename => $filename,
do_etag => 1,
+ dis_type => 'inline',
content => $content
});
}

0 comments on commit 9ca7190

Please sign in to comment.