debug "$REQUEST_METHOD $REQUEST_URI $SERVER_PROTOCOL $_DATE"
ingest() {
- local J="$1"
+ local J="$1" ztmp="${TMP:-/tmp}/zipfile_$$.zip"
# json_get "$J" title
# json_get "$J" parts.comments
| sed 's;<[^>]*>;;g'
;;
*.docx)
- printf %s "$content" |base64 -d \
- | unzip -qc /dev/stdin word/document.xml \
+ printf %s "$content" |base64 -d >"$ztmp"
+ unzip -qc "$ztmp" word/document.xml \
| head -c 128M | sed 's;<[^>]*>;;g'
+ rm -- "$ztmp"
;;
*.xlsx)
- printf %s "$content" |base64 -d \
- | unzip -qc /dev/stdin xl/sharedStrings.xml \
+ printf %s "$content" |base64 -d >"$ztmp"
+ unzip -qc "$ztmp" xl/sharedStrings.xml \
| head -c 128M | sed 's;<[^>]*>; ;g'
+ rm -- "$ztmp"
;;
*.odt)
- printf %s "$content" |base64 -d \
- | unzip -qc /dev/stdin content.xml \
+ printf %s "$content" |base64 -d >"$ztmp"
+ unzip -qc "$ztmp" content.xml \
| head -c 128M | sed 's;<[^>]*>;;g'
+ rm -- "$ztmp"
;;
*.ods|*.odp)
- printf %s "$content" |base64 -d \
- | unzip -qc /dev/stdin content.xml \
+ printf %s "$content" |base64 -d >"$ztmp"
+ unzip -qc "$ztmp" content.xml \
| head -c 128M | sed 's;<[^>]*>; ;g'
+ rm -- "$ztmp"
;;
*):;;
esac