Fix #6521 - respect uri.path in upload URLs