repo: Fix a possible race condition that can cause a double upload