better validation for OC_App::getAppPath()

fixes https://github.com/owncloud/core/issues/9122

please review @PVince81