[stable6] backport webdav copy fix + share key pattern matching fix

Backport of
- webdav copy fix with encryption: https://github.com/owncloud/core/pull/9897 (required prerequisite)
- fix share key with encryption: https://github.com/owncloud/core/pull/11137

Fixes https://github.com/owncloud/core/issues/11252

@schiesbn the backport of #11137 applies with no major conflicts thanks to the backport of #9897.

- [ ] Needs extensive testing
- [ ] Double check that there are no remaining bogus preg_match or glob calls