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