backport of #5496, fixes #5421 for stable5
Merge pull request #5579 from owncloud/backport_5496

backport of #5496, fixes #5421 for stable5