LPS-43773

Hey Hugo,

The logic may seem a bit wonky, but it has to be in order to handle Sergio's use case. With this code, it will work properly for:

test.txt
test.test.txt
test--tempRandomSuffix--.txt

Let me know if you have any questions.