remove duplicate code
Merge pull request #4542 from owncloud/fixing-4504-master

remove duplicate code