X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=attachment.sh;h=9b5d54590258c55d0115155ceb6dadf0dd60d908;hb=1ceb1ca02e8cc1a55443152b8505e3949007ce54;hp=b5e8491298ed398a3e7e733d37ef109c74b10405;hpb=cb3cd16be2190c7e91aa1dafd22b295b641c0d32;p=shellwiki diff --git a/attachment.sh b/attachment.sh index b5e8491..9b5d545 100755 --- a/attachment.sh +++ b/attachment.sh @@ -61,7 +61,19 @@ attachment_convert(){ } 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##*/}"