Backport #10958

Backport of https://github.com/owncloud/core/pull/10958 to stable7.