Fix share download

fixes download issue introduced by https://github.com/owncloud/core/pull/10755

This is a fairly large change please test thoroughly as im sure we missed some cases
On a related note: I'm also not sure howe we should handle the `application.php`, currently we have one in `/core/` and are going to add for another one for the settings.

What would be the right approach?

- Having one application.php for whole core (excluding apps they need their one)
- Having one application.php for every folder, i.e. one in /core/ and one in /settings/ and one for every app

@Raydiation THX!