From 1a15c7f32cb58df3c19ef9bd4622115414d62df3 Mon Sep 17 00:00:00 2001
From: Anthony Borghi <anthony.borghi@veremes.com>
Date: Thu, 31 Jan 2019 16:11:59 +0100
Subject: [PATCH] changement du content disposition pour que les documents
 s'ouvrent directement dans le navigateur

---
 vas/rest/ws/vitis/File_downloader.class.inc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/vas/rest/ws/vitis/File_downloader.class.inc b/vas/rest/ws/vitis/File_downloader.class.inc
index bb8749da..fcc86a89 100755
--- a/vas/rest/ws/vitis/File_downloader.class.inc
+++ b/vas/rest/ws/vitis/File_downloader.class.inc
@@ -108,8 +108,11 @@ class File_downloader extends Vitis {
                   $sFileName = $this->oFilesManager->getFileName($sPath);
                   $sContentType = $this->oFilesManager->oFileInterface->mime_content_type($sPath);
                   header("Content-Type: " . $sContentType);
-                  header("Content-disposition: attachment; filename=\"" . $sFileName . "\"");
-                  header('Content-Length: ' . filesize($sPath));
+                  if (in_array($sContentType, array("text/plain", 'application/pdf'))){
+                      header("Content-disposition: inline; filename=\"" . $sFileName . "\"");
+                  } else {
+                      header("Content-disposition: attachment; filename=\"" . $sFileName . "\"");
+                  }
                   header('Content-Length: ' . $this->oFilesManager->oFileInterface->filesize($sPath));
                   if ($sContentType === "application/octet-stream") {
                     header("Content-Transfer-Encoding: Binary");
-- 
GitLab