summaryrefslogtreecommitdiff
path: root/rt/html/NoAuth/images/autohandler
diff options
context:
space:
mode:
authorivan <ivan>2004-12-03 20:40:48 +0000
committerivan <ivan>2004-12-03 20:40:48 +0000
commitd39d52aac8f38ea9115628039f0df5aa3ac826de (patch)
treec77529c4e4dbb9bf832fcef14538dc16b2f7a110 /rt/html/NoAuth/images/autohandler
parentc582e92888b4a5553e1b4e5214cf35217e4a0cf0 (diff)
import rt 3.2.2
Diffstat (limited to 'rt/html/NoAuth/images/autohandler')
-rw-r--r--rt/html/NoAuth/images/autohandler21
1 files changed, 21 insertions, 0 deletions
diff --git a/rt/html/NoAuth/images/autohandler b/rt/html/NoAuth/images/autohandler
new file mode 100644
index 0000000..86f3b22
--- /dev/null
+++ b/rt/html/NoAuth/images/autohandler
@@ -0,0 +1,21 @@
+<%init>
+
+# This autohandler will spit out RT's images if the user hasn't
+# properly configured their webserver to stop RT from passing
+# images through the mason handler.
+
+my $file = $m->base_comp->source_file;
+my $type = "application/octet-stream";
+
+if ($file =~ /\.(gif|png|jpe?g)$/i) {
+ $type = "image/$1";
+ $type =~ s/jpg/jpeg/gi;
+}
+
+die unless (-f $file && -r $file);
+$r->content_type($type);
+open (FILE, "<$file") || die;
+$m->out($_) while (<FILE>);
+close(FILE);
+$m->abort;
+</%init>