From 8cba6b3f6af0b01adb345c5cd367ca7f7c41388e Mon Sep 17 00:00:00 2001 From: Carsten Schmitz Date: Tue, 1 Feb 2022 17:27:03 +0100 Subject: [PATCH] Fixed issue: Downloading a single file from response does not work on Winwdows --- application/controllers/ResponsesController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/ResponsesController.php b/application/controllers/ResponsesController.php index 126fc4d20a0..89512e7035d 100644 --- a/application/controllers/ResponsesController.php +++ b/application/controllers/ResponsesController.php @@ -629,7 +629,7 @@ public function actionDownloadfile(int $surveyId, int $responseId, int $qid, int if (isset($aQuestionFiles[$index])) { $aFile = $aQuestionFiles[$index]; // Real path check from here: https://stackoverflow.com/questions/4205141/preventing-directory-traversal-in-php-but-allowing-paths - $sDir = Yii::app()->getConfig('uploaddir') . "/surveys/" . $surveyId . "/files/"; + $sDir = Yii::app()->getConfig('uploaddir') . DIRECTORY_SEPARATOR . "surveys" . DIRECTORY_SEPARATOR . $surveyId . DIRECTORY_SEPARATOR."files" . DIRECTORY_SEPARATOR; $sFileRealName = $sDir . $aFile['filename']; $sRealUserPath = realpath($sFileRealName); if ($sRealUserPath === false || strpos($sRealUserPath, $sDir) !== 0) {