Marking this as major because the error message is misleading and causing unnecessary pain for support.
In FileSystemAttachmentDataDao.getDeleteErrorReason() there are two bugs, see inline comments below:
private static String getDeleteErrorReason(File attachmentFolderForThisPage)
{
if(!attachmentFolderForThisPage.exists())
{
return REASON_DIR_DOES_NOT_EXIST;
}
if(!attachmentFolderForThisPage.isDirectory())
{
return REASON_NOT_A_DIRECTORY;
}
if(attachmentFolderForThisPage.listFiles().length > 2) // as pointed out by Don, this should be 0
{
return REASON_NOT_EMPTY;
}
if(attachmentFolderForThisPage.canWrite()) // this should be a case where the directory is not writeable
{
return REASON_NOT_WRITABLE;
}
return REASON_UNKNOWN;
}