imap-download: find returns absolute filenames; fix pathing for rm

This commit is contained in:
Starbeamrainbowlabs 2021-05-26 22:42:44 +01:00
parent 2235764ea6
commit d65701051f
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -98,13 +98,13 @@ do_attachments() {
# Unpack the attachments
munpack -C "${temp_dir}" "${filename}";
# Delete the original email file and any description files
rm "${temp_dir}/${filename}";
rm "${temp_dir}/$(basename "${filename}")";
find "${temp_dir}" -iname '*.desc' -delete;
# Move the attachment files to the output directory
while read -r attachment; do
log_msg "Extracted attachment ${attachment}";
chmod 0775 "${temp_dir}/${attachment}";
chmod 0775 "${attachment}";
move_attachment "${attachment}";
done < <(find "${temp_dir}" -type f);
done < <(find "${dir_newmail}" -type f);