Index: openacs-4/packages/acs-content-repository/tcl/revision-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/revision-procs.tcl,v diff -u -r1.21.2.3 -r1.21.2.4 --- openacs-4/packages/acs-content-repository/tcl/revision-procs.tcl 6 Jul 2005 01:28:07 -0000 1.21.2.3 +++ openacs-4/packages/acs-content-repository/tcl/revision-procs.tcl 17 Oct 2005 12:46:33 -0000 1.21.2.4 @@ -69,26 +69,30 @@ file { set path [cr_fs_path $storage_area_key] set filename [db_string write_file_content ""] - if { $string_p } { - set fd [open $filename "r"] - set text [read $fd] - close $fd - return $text + if {[empty_string_p $filename]} { + ad_return -code error "No content for the revision $revision_id. This seems to be an error which occured during the upload of the file" } else { - # JCD: for webdavfs there needs to be a content-length 0 header - # but ns_returnfile does not send one. Also, we need to - # ns_return size 0 files since if fastpath is enabled ns_returnfile - # simply closes the connection rather than send anything (including - # any headers). This bug is fixed in AOLServer 4.0.6 and later - # but work around it for now. - set size [file size $filename] - if {!$size} { - ns_set put [ns_conn outputheaders] "Content-Length" 0 - ns_return 200 text/plain {} - } else { - ns_returnfile 200 $mime_type $filename - } - } + if { $string_p } { + set fd [open $filename "r"] + set text [read $fd] + close $fd + return $text + } else { + # JCD: for webdavfs there needs to be a content-length 0 header + # but ns_returnfile does not send one. Also, we need to + # ns_return size 0 files since if fastpath is enabled ns_returnfile + # simply closes the connection rather than send anything (including + # any headers). This bug is fixed in AOLServer 4.0.6 and later + # but work around it for now. + set size [file size $filename] + if {!$size} { + ns_set put [ns_conn outputheaders] "Content-Length" 0 + ns_return 200 text/plain {} + } else { + ns_returnfile 200 $mime_type $filename + } + } + } } lob {