View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
17620Bug reportsFile managerpublic2022-07-27 15:21
Reporterterryaulenbach Assigned Togalads  
PrioritynoneSeveritypartial_block 
Status assignedResolutionopen 
Product Version3.25.20 
Summary17620: (v3.27.11) Following email link from response email, clicking on link to file causes CHttpException
Description

When you click on the individual response link in the notification email and then click on a link to a file, you get a CHttpException error. If you go to all responses and click on the download link for the particular submission, you do get the ZIP file.

Steps To Reproduce
  1. click on the link to the individual response in the notification email.
  2. click on the link to the uploaded file.
  3. get the error page.
TagsNo tags attached.
Attached Files
CHttpException.png (87,887 bytes)   
CHttpException.png (87,887 bytes)   
Bug heat4
Complete LimeSurvey version number (& build)Version 3.27.11+210809
I will donate to the project if issue is resolvedNo
BrowserFirefox, Chrome, Edge, Opera
Database type & versionPostgreSQL 9.6.12 (win32)
Server OS (if known)Windows Server 2012 R2 Standard Edition
Webserver software & version (if known)Apache/2.4.46
PHP Version7.3.18

Users monitoring this issue

There are no users monitoring this issue.

Activities

galads

galads

2021-09-27 11:24

reporter   ~66622

Hello,

Are you trying to use the response link as superadmin or a user with the right permission?

I cannot reproduce this error.

terryaulenbach

terryaulenbach

2021-09-27 16:21

reporter   ~66626

It was reported by a "normal" user and I also get it as superadmin.

terryaulenbach

terryaulenbach

2022-07-27 15:21

reporter   ~71183

I found the offending line in the code and what needs to be changed. Line 639 in application/controllers/admin/reponses.php (v3.27.11):

 $sDir = Yii::app()->getConfig('uploaddir') . "/surveys/" . $iSurveyId . "/files/";

In Windows the slashes mess up the path when $sRealUserPath and $sDir get compared:

 if ($sRealUserPath === false || strpos($sRealUserPath, $sDir) !== 0)         (e.g.  /a/b/c/d vs /a/b\c\d)

I had to change line 639 to:

 $sDir = Yii::app()->getConfig('uploaddir') . DIRECTORY_SEPARATOR ."surveys" . DIRECTORY_SEPARATOR . $iSurveyId . DIRECTORY_SEPARATOR . "files" . DIRECTORY_SEPARATOR;

As I was testing I also found that our DEV server is using v3.28.21 and that same line is different (realpath fixes everything except the trailing '/'):

 $sDir = realpath(Yii::app()->getConfig('uploaddir') . "/surveys/" . $iSurveyId . "/files/") . '/';

I changed it to:

 $sDir = realpath(Yii::app()->getConfig('uploaddir') . "/surveys/" . $iSurveyId . "/files/") . DIRECTORY_SEPARATOR;

The file link now works in both versions.

Issue History

Date Modified Username Field Change
2021-09-23 14:05 terryaulenbach New Issue
2021-09-23 14:05 terryaulenbach File Added: CHttpException.png
2021-09-27 11:24 galads Note Added: 66622
2021-09-27 11:24 galads Bug heat 0 => 2
2021-09-27 11:24 galads Assigned To => galads
2021-09-27 11:24 galads Status new => feedback
2021-09-27 16:21 terryaulenbach Note Added: 66626
2021-09-27 16:21 terryaulenbach Bug heat 2 => 4
2021-09-27 16:21 terryaulenbach Status feedback => assigned
2022-07-27 15:21 terryaulenbach Note Added: 71183