Index: openacs-4/packages/search/tcl/search-convert-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/search/tcl/search-convert-procs.tcl,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/search/tcl/search-convert-procs.tcl 7 Aug 2017 23:48:29 -0000 1.5 +++ openacs-4/packages/search/tcl/search-convert-procs.tcl 24 May 2019 13:45:42 -0000 1.5.2.1 @@ -46,7 +46,7 @@ set convert_command {catppt $filename >$tmp_filename} } application/pdf { - set convert_command {pdftotext -q $filename $tmp_filename} + set convert_command {pdftotext $filename $tmp_filename} } application/vnd.oasis.opendocument.text - application/vnd.oasis.opendocument.text-template - @@ -84,16 +84,24 @@ } } - if {[catch {eval exec $convert_command} err]} { - catch {file delete -- $tmp_filename} - ns_log Error "SEARCH: conversion failed - $convert_command: $err" - return + ad_try { + set convert_command [subst $convert_command] + exec -- {*}$convert_command + } on error {errorMsg} { + if {$mime_type eq "application/pdf" && + [string first $errorMsg "Command Line Error: Incorrect password"] >= 0} { + ns_log warning "SEARCH: pdf seems password protected - $convert_command" + } else { + ns_log error "SEARCH: conversion failed - $convert_command: $errorMsg" + } + } on ok {d} { + set fd [open $tmp_filename "r"] + set result [read $fd] + close $fd + } finally { + file delete -- $tmp_filename } - set fd [open $tmp_filename "r"] - set result [read $fd] - close $fd - file delete -- $tmp_filename return $result }