From 8df508676f3589e9011dd7f59a77f49101bc7317 Mon Sep 17 00:00:00 2001
From: Laurent Giovannoni <laurent.giovannoni@maarch.org>
Date: Wed, 3 Jan 2018 17:09:14 +0100
Subject: [PATCH] FIX #6870

---
 modules/attachments/view_attachment.php | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/modules/attachments/view_attachment.php b/modules/attachments/view_attachment.php
index 43721ae3c05..b1b690ced3c 100755
--- a/modules/attachments/view_attachment.php
+++ b/modules/attachments/view_attachment.php
@@ -155,6 +155,13 @@ if (! empty($_SESSION['error'])) {
             $file      = $docserver . $path . $filename;
             $file      = str_replace("#", DIRECTORY_SEPARATOR, $file);
 
+            if (!copy($file, $_SESSION['config']['tmppath'] . DIRECTORY_SEPARATOR  . $filename)) {
+                echo 'error';
+                exit();
+            } else {
+                $file = $_SESSION['config']['tmppath'] . DIRECTORY_SEPARATOR  . $filename;
+            }
+
             if (strtoupper($format) == "MAARCH") {
                 if (file_exists($file)) {
                     $myfile = fopen($file, "r");
-- 
GitLab