[SAK-39974] UploadAudioMediaServlet: Problems with file separators in Windows environments Created: 08-May-2018  Updated: 31-May-2018  Resolved: 08-May-2018

Status: Verified
Project: Sakai
Component/s: Tests & Quizzes (Samigo)
Affects Version/s: 12.1
Fix Version/s: 11.5 [Tentative], 12.2, 19.0

Type: Bug Priority: Critical
Reporter: Miguel Pellicer Assignee: Miguel Pellicer
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

12 status: Resolved
11 status: Resolved
Test Plan:

Create an assessment using audio question. Take assessment as student. Listen to student response as instructor.


 Description   

Affects audio questions, you can't upload audio files in Windows, the comparison of the file paths use different separators, so always throws an error which is only debugged instead of printed:

https://github.com/sakaiproject/sakai/blob/master/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/UploadAudioMediaServlet.java#L104

 

Example:

repositoryPath->D:\opt\sakai\sakai\/samigo/answerUploadRepositoryPath/
mediaLocation->D:\opt\sakai\sakai\samigo\answerUploadRepositoryPath/jsf/upload_tmp/assessment4/question4/student0181/audio_2_4.au
mediaFile.getCanonicalPath()->D:\opt\sakai\sakai\samigo\answerUploadRepositoryPath\jsf\upload_tmp\assessment4\question4\student0181\audio_2_4.au

Then, the comparison "if (mediaFile.getCanonicalPath().equals (mediaLocation))" will fail forever, because use different separators.

https://github.com/sakaiproject/sakai/blob/master/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/UploadAudioMediaServlet.java#L107

 



 Comments   
Comment by Miguel Pellicer [ 08-May-2018 ]

Seems it was caused by this:

https://github.com/sakaiproject/sakai/commit/0f30d0049f6ec8b47af90d60543cfb74106f0436#diff-334e93b9b5c55903c1edbc1fc270ee57

Comment by Miguel Pellicer [ 08-May-2018 ]

This file makes more dangerous operations using a hardcoded file separator:

https://github.com/sakaiproject/sakai/blob/master/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/delivery/UploadAudioMediaServlet.java#L313

Comment by Matthew Jones [ 08-May-2018 ]

Lowered priority of this to Critical as it meets the definition of
"Render one feature unusable with no workaround."

https://confluence.sakaiproject.org/display/MGT/Sakai+Jira+Guidelines#SakaiJiraGuidelines-PriorityPriority(UpdatedforSakai12,inspiredbyDrupalpriorities)

Comment by Miguel Pellicer [ 08-May-2018 ]

Thanks Matthew Jones , I need to study a bit more the new criteria to set-up the priority correctly 

Comment by Matthew Jones [ 30-May-2018 ]

Is someone on Windows able to verify this one?

Comment by Miguel Pellicer [ 30-May-2018 ]

Let me do it Matthew Jones

Comment by Miguel Pellicer [ 30-May-2018 ]

Tested in a Windows environment:

 

30-may-2018 15:25:40.219 INFO [http-nio-8080-exec-6] org.sakaiproject.tool.assessment.ui.servlet.delivery.UploadAudioMediaServlet.writeToFile Acknowleged: D:\opt\sakai\sakai\samigo\answerUploadRepositoryPath\jsf\upload_tmp\assessment1\question1\wademo01@mailinator.com\audio_1_1.au-> 933932 bytes.
30-may-2018 15:25:42.576 INFO [http-nio-8080-exec-6] org.sakaiproject.tool.assessment.ui.servlet.delivery.UploadAudioMediaServlet.doPost Audio has been saved and submitted as answer to the question. Any old recordings have been removed from the system.
30-may-2018 15:25:42.731 INFO [http-nio-8080-exec-7] org.sakaiproject.tool.assessment.ui.servlet.delivery.ShowMediaServlet.doPost ****1. media file size=933932
30-may-2018 15:25:42.731 INFO [http-nio-8080-exec-7] org.sakaiproject.tool.assessment.ui.servlet.delivery.ShowMediaServlet.doPost ****2. setMimeType=null

 

I verified the file is in the disk and the instructor can access it when grading the response.

Generated at Sun Sep 22 10:32:32 CDT 2019 using Jira 8.0.3#800011-sha1:073e8b433c2c0e389c609c14a045ffa7abaca10d.