Project

General

Profile

Bug #3640

Document cannot be downloaded

Added by Bas Wijnen about 8 years ago. Updated almost 8 years ago.

Status:
Bug resolved
Priority:
Urgent
Assignee:
-
Category:
-
Target version:
Start date:
22/06/2011
Due date:
% Done:

80%

Estimated time:
0.00 h
Spent time:
Complexity:
Easy
SCRUM pts - complexity:
?

Description

Documents which are to be downloaded (as opposed to viewed in the browser) don't work in 1.8.8.2, because the given link lacks the course id.
This is a serious problem, because all pdf files, for example, can no longer be downloaded by students (or teachers, for that matter).

This can be fixed by changing
$url = $www.$path;
into
$url = $www.$path.'?'.api_get_cidreq ();
on line 154 of main/document/document.inc.php (that's from the released file, not the repository version, because I haven't figured out how to import that yet).


Files

History

#1

Updated by Julio Montoya about 8 years ago

It works at least for me in

http://chamilodev.beeznest.com/main/document/document.php?cidReq=CHAMILO

user:password

prueba:prueba

#2

Updated by Julio Montoya about 8 years ago

  • Status changed from New to Needs more info
#3

Updated by Bas Wijnen about 8 years ago

The files you have there are all viewable in the browser (jpg and html). The bug is only for files which need to be downloaded, such as pdf. You can see this from the link which points to showinframesmin.php (in your course), not to the document itself (which triggers the bug).

Also, the error is that the user is not authorized to view the document. This means that to trigger the error, you need a course which is not publicly accessible. I just tried to reproduce it on campus.chamilo.org, but couldn't, because documents can be downloaded from my course there without logging in.

If the course ID is not passed on the address line, there is no session. To trigger this bug, that must be a problem.

#4

Updated by Julio Montoya about 8 years ago

I uploaded a PDF file and set the course to "Private - access authorized to course members only"

I could download the file THIS_IS_A_TES(3).pdf as an student prueba:prueba

maybe I'm doing something wrong? I really want to get this bug :)

http://chamilodev.beeznest.com/main/document/document.php?cidReq=CHAMILO

I test in Google chrome...

#5

Updated by Juan Carlos Raña Trabado about 8 years ago

Please Bas:

Your system: Windows, Linux, Mac...?
Your browser and browser ver: Firefox 4.0, Safari 5, Chrome..., ?
Do you have a browser with a plugin to view pdf ? What?

Thanks

#6

Updated by Bas Wijnen about 8 years ago

Chamilo runs on a webhost who runs Ubuntu with php 5.3.2-1ubuntu4.7. I've installed Chamilo 1.8.7 on it, and upgraded to 1.8.8.2. The one Julio sent looks different (larger icons, most notably). It's at http://www.maartens-elo.nl/ (But there's no anonymous login, so you can't see much).

The system I'm viewing from is Debian GNU/Linux unstable, with no non-free stuff installed (no flash or adobe pdf reader etc).
My browser is Iceweasel (Debian's Firefox), to be precise: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.19) Gecko/20110430 Iceweasel/3.5.19 (like Firefox/3.5.19)

The request headers from a random request on the ELO:

Host: www.maartens-elo.nl
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.19) Gecko/20110430 Iceweasel/3.5.19 (like Firefox/3.5.19)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.maartens-elo.nl/user_portal.php?nosession=true
Cookie: ch_sid=efr5grbr7555abba45pq18aps5

#7

Updated by Juan Carlos Raña Trabado about 8 years ago

This information is more than enough. When I have a bit of time will I look, I think there is a solution.
Thanks for your information.

#8

Updated by Juan Carlos Raña Trabado about 8 years ago

When you clicking on the diskette icon the download work?

#9

Updated by Bas Wijnen about 8 years ago

I don't need a solution, I alread have it. :) As I wrote in the original report, adding the course id to the url solves the problem.

The bug doesn't seem to be present in 1.8.8, but only in 1.8.8.2, which seems strange. But I too don't have a problem downloading the example file from the link Julio posted.

The download doesn't work from the diskette icon either, which makes sense because it uses the same variable to create the link (so it links to the same place). Adding cidreq on line 154 fixes both links at once, as expected.

#10

Updated by Bas Wijnen about 8 years ago

Ok, small correction:
Line 154 should have been 158.

However, looking more closely at the code, I really meant to comment out line 156-158, and use the code above (which is overridden by those lines).

Can someone confirm that this is a good idea? At least it seems to work here.

Side-note: I've just updated my desktop, and now pdf is also recognised as a format which can be opened in the browser. The problem is still present for .doc files, for example. With the lines commented out, it works though.

#11

Updated by Yannick Warnier about 8 years ago

  • Target version set to 1.8.8.4
#12

Updated by Cesar Perales almost 8 years ago

works fine for me.
lamp. ubuntu 10.10
chamilo 1.8.8.4 from repository
course set as Private - access authorized to course members only
file *.exe
firefox 3.6.18

#13

Updated by Yannick Warnier almost 8 years ago

  • Status changed from Needs more info to Assigned
  • Assignee set to Julio Montoya

someone apply the patch if ok...

#14

Updated by Julio Montoya almost 8 years ago

  • Status changed from Assigned to Bug resolved
  • Assignee deleted (Julio Montoya)

works for me

Also available in: Atom PDF