Fix bug 863366 - Refactor S3 publishing