re #5716 Refactor duplicate file download code as per feedback