Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Fix to HEAT #1824 - force download of vendor specific files
Browse files Browse the repository at this point in the history
  • Loading branch information
ghecquet committed Feb 10, 2017
1 parent cb8a2e1 commit 6dfd745
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions core/src/plugins/editor.browser/FileMimeSender.php
Expand Up @@ -56,7 +56,7 @@ public function switchAction(\Psr\Http\Message\ServerRequestInterface $requestIn
$httpVars = $requestInterface->getParsedBody();

$repository = RepositoryService::getRepositoryById($httpVars["repository_id"]);

if (UsersService::usersEnabled()) {
$loggedUser = $ctx->getUser();
if (!$loggedUser->canSwitchTo($repository->getId())) {
Expand Down Expand Up @@ -114,10 +114,14 @@ public function switchAction(\Psr\Http\Message\ServerRequestInterface $requestIn
$fileMime = "application/octet-stream";
}

if(strpos($fileMime, "application/vnd") === 0){
// Do not open VND (vendor specific) directly in browser.
$fileMime = "application/octet-stream";
}

//Send headers
$responseInterface = HTMLWriter::responseWithInlineHeaders($responseInterface, basename($selectedNodeUrl), $filesize, $fileMime);
$aSyncReader = new \Pydio\Core\Http\Response\AsyncResponseStream(function () use ($selectedNode){

$aSyncReader = new \Pydio\Core\Http\Response\AsyncResponseStream(function () use ($selectedNode) {
$stream = fopen("php://output", "a");
MetaStreamWrapper::copyFileInStream($selectedNode->getUrl(), $stream);
fflush($stream);
Expand Down

0 comments on commit 6dfd745

Please sign in to comment.