Fix Issue 6553

Fixes this issue https://github.com/owncloud/core/issues/6553
if (substr($path, -1) !== '/' && substr($path, -1) !== '\\') {