Backport fix-5828 manually to stable5. Implements 17e45e2 on stable5
Merge pull request #7229 from owncloud/stable5-fix-5828-backport

Backport fix-5828 manually to stable5. Implements 17e45e2 on stable5