elif [ -f "$cachepath" ]; then
printf %s "$attpath"
return 0
- elif ! touch "$cachepath"; then
+ elif ! mkdir -p -- "${cachepath%/*}" && touch "$cachepath"; then
printf %s "$attpath"
return 0
fi
}
if [ "${PATH_INFO%/\[attachment\]/}" != "${PATH_INFO}" ]; then
- theme_attachments "${PATH_INFO%\[attachment\]/}"
+ . "$_EXEC/multipart.sh"
+ if multipart_cache; then
+ mkdir -p "$_DATA/pages/${PATH_INFO%/\[attachment\]/}/#attachments/"
+ n=1; while filename=$(multipart_filename "file" "$n"); do
+ filename="$(printf %s "$filename" |tr /\\0 __)"
+ multipart "file" "$n" >"$_DATA/pages/${PATH_INFO%/\[attachment\]/}/#attachments/$filename"
+ n=$((n + 1))
+ done
+ rm -- "$multipart_cachefile"
+ REDIRECT "${_BASE}${PATH_INFO}"
+ else
+ theme_attachments "${PATH_INFO%\[attachment\]/}"
+ fi
elif [ "${PATH_INFO%/\[attachment\]/*}" != "${PATH_INFO}" ]; then
attpath="${PATH_INFO%/\[attachment\]/*}/#attachments/${PATH_INFO##*/}"