aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/attachment.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-07-08 11:25:30 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-07-08 11:25:30 -0400
commit66f35e30dcea03c631a293e2341771277543b4ae (patch)
tree3ef05986a53e708e401e3f4af30d0e4a5da9140a /IkiWiki/Plugin/attachment.pm
parent5ccd0cb518f663872c93dc376f756bf71996034d (diff)
downloadikiwiki-66f35e30dcea03c631a293e2341771277543b4ae.tar
ikiwiki-66f35e30dcea03c631a293e2341771277543b4ae.tar.gz
another try at dealing with CGI.pm problem
open the temp file if all attempts to get a fd fail
Diffstat (limited to 'IkiWiki/Plugin/attachment.pm')
-rw-r--r--IkiWiki/Plugin/attachment.pm8
1 files changed, 7 insertions, 1 deletions
diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm
index f4f64b46a..ed1cd61fe 100644
--- a/IkiWiki/Plugin/attachment.pm
+++ b/IkiWiki/Plugin/attachment.pm
@@ -88,6 +88,10 @@ sub formbuilder (@) { #{{{
# of the temp file that CGI writes the upload to.
my $tempfile=$q->tmpFileName($filename);
+ if (! defined $tempfile) {
+ error("failed to determine temp filename");
+ }
+
$filename=IkiWiki::titlepage(
IkiWiki::possibly_foolish_untaint(
attachment_location($form->field('page')).
@@ -136,7 +140,9 @@ sub formbuilder (@) { #{{{
# needed by old CGI versions
$fh=$q->param('attachment');
if (! defined $fh || ! ref $fh) {
- error("failed to get filehandle");
+ # even that doesn't always work,
+ # fall back to opening the tempfile
+ open($fh, "<", $tempfile) || error("failed to open $tempfile: $!");
}
}
binmode($fh);