Forum OpenACS Q&A: Problem with File Manager

Collapse
Posted by Richard Hamilton on
Does anyone know why this happens when trying to upload a file? I assume that any kind of permissions checking would refuse access more elegantly than this.

_________________________________________________

Request Error

no value given for parameter "exception_text" to "ad_return_complaint"
    while executing
"ad_return_complaint "
    <li>The title you supply must have one of the following extensions:<br>
    [ad_parameter Extensions file-manager]""
    invoked from within
"if {![empty_string_p $title] && [empty_string_p [file ext $title]]} {
    ad_return_complaint "
    <li>The title you supply must have one of the foll..."
    ("uplevel" body line 26)
    invoked from within
"uplevel {
          # /www/admin/file-manager/file-upload-2.tcl

ad_page_contract {

    Process a file upload

    @author  mailto:ron@arsdigita.com
    @creat..."
    (procedure "code::tcl::/web/oakmasters/packages/file-manager/www/file-up..." line 2)
    invoked from within
"code::tcl::$__adp_stub"
    invoked from within
"if { [file exists $__adp_stub.tcl] } {

      # ensure that data source preparation procedure exists and is up-to-date
      adp_init tcl $__adp_stub
..."
    ("uplevel" body line 3)
    invoked from within
"uplevel {

    if { [file exists $__adp_stub.tcl] } {

      # ensure that data source preparation procedure exists and is up-to-date
      adp_init t..."
    (procedure "adp_prepare" line 2)
    invoked from within
"adp_prepare "
    (procedure "template::adp_parse" line 30)
    invoked from within
"template::adp_parse [file root [ad_conn file]] {}"
    (procedure "adp_parse_ad_conn_file" line 7)
    invoked from within
"$handler"
    ("uplevel" body line 2)
    invoked from within
"uplevel $code"
    invoked from within
"ad_try {
    $handler
      } ad_script_abort val {
    # do nothing
      }"
    invoked from within
"rp_serve_concrete_file [ad_conn file]"
    (procedure "rp_serve_abstract_file" line 60)
    invoked from within
"rp_serve_abstract_file "$root/$path""
    ("uplevel" body line 2)
    invoked from within
"uplevel $code"
    invoked from within
"ad_try {
    rp_serve_abstract_file "$root/$path"
    set tcl_url2file([ad_conn url]) [ad_conn file]
    set tcl_url2path_info([ad_conn url]) [ad_conn path_inf..."

Collapse
Posted by Richard Hamilton on
ad_return_complaint requires two parameters, and exception count and exeption text. The file-upload-2.tcl file calls ad_return_compaint if the file extension fails certain tests, but it omits the exception count - hence the error.

Modifying the code to include an exception count of 1 sorts it out i.e:

if {![empty_string_p $title] && [empty_string_p [file ext $title]]} {
ad_return_complaint 1 "explanitory text"
ad_script abort
}

This proc is called in more than one place so this needs updating in all cases.

Regards
Richard

Collapse
Posted by Jeff Davis on
It's a bug. ad_return_complaint should be called with the number of errors and an html fragment (which is disgusting but the proc is old...).

In this case the number is missing. I grepped the code and there are a dozen other places where it's called incorrectly (although usually with a string ostensibly for a title in arg1).

I fixed them on the oacs-5-0 branch.