is there a way to force the browser to download a SimpleFile via a Controller response?
Any hint in the right direction would help a lot
Thanks in advance
The issue is mainly that the ISimpleFile abstraction doesn’t provide all information that is needed by the Response classes to properly handle the display/download. You can work around that by fetching the file from the root folder. You can find an example over here: https://github.com/nextcloud/deck/blob/master/lib/Service/FileService.php#L211-L247
How do you submit the request to the download endpoint? It seems that it is a XHR request so the currently opened site gets the response data instead of the browser to handle the download.
just when I thought I’m done with this sort of unnecessary mistakes…
Oh regarding the initial problem: I found that she SimpleFile Class seems to have a method ‘read’ which does the fopen(‘r’) on the $file property. So this seems to work for me without the workaround:
$response = new StreamResponse($zipFile->read());
Ah indeed, I even implemented that a while ago https://github.com/nextcloud/server/pull/10122 Sorry, I was a bit confused by the fallback in the deck app then. Good to hear that it works now.