attachment_convert(){
local attpath="$1"
- local cachepath="${attpath%/#attachments/*}/#cache/${attpath#*/#attachments/}"
- local res junk
+ local cachepath res junk
+
+ # always put caches in data directory
+ [ "${attpath#"${_EXEC}"}" = "${attpath}" ] \
+ && cachepath="${attpath}" || cachepath="${_DATA}${attpath#"${_EXEC}"}"
+ cachepath="${cachepath%/#attachments/*}/#cache/${cachepath#*/#attachments/}"
case $attpath in
*.webm|*.mp4|*.mkv|*.avi)