Backport of S3 ext storage fixes to stable6

@ser72 can you test this branch ?

Backport of https://github.com/owncloud/core/pull/6153