Fix share key pattern matching

Fixes https://github.com/owncloud/core/issues/11127

But there's another failing pattern, unit test will fail.
Still looking for a solution...
Wrote a unit test, indeed it can happen... will see whether I can just reuse the `$realFile` somehow.