backport
https://github.com/owncloud/core/pull/1751