In this post I am sharing tips how to avoid an issue that may happen when repository is used (if you use database, this issue won't happen). Repository was introduced in 7.4, so if your Pega version is between 7.4 and 8.4.1, and repository is used, this issue could possibly happen. Whether this issue happens or not depends on which version and which attachment component you are using, so I would advise to test. If you are observing "~ not deleted from service export directory!" error message in the PegaRULES log file sometimes, the issue is probably happening.
User A selects a file in attachment screen (see below screenshot). Before user A clicks on "Attach" or "Cancel" button, if user B selects a same name file (with different content), then user A will end up with attaching user B's file.
This will be fixed in 8.4.2. If it is difficult to apply patch release, you can apply quick local change. Please see attached for How-to.