chamilo / chamilo-lms

Chamilo is a learning management system focused on ease of use and accessibility
https://chamilo.org
GNU General Public License v3.0
806 stars 480 forks source link

Bugs with course backup when base64 images are into exercises #3286

Open tanchon opened 4 years ago

tanchon commented 4 years ago

Hi,

Some teachers told me they cannot copy part of their courses, as backup tool should permit ("copy course" => "Let me select learning objects"). Just some courses are concerned. Whatever is the selection of the learning objects in the courses concerned, the same result occurs : a failure ("Error 413 - Request entity too large..." or this message "The length of the requested URL exceeds the capacity limit for this server. The request cannot be processed. ").

Surprisingly, even when we just select one or two documents or exercises, the problem appears. But when the teacher wants to make a full copy of the course... it works ! (into the same course)

I spend many hours to understand the origin of the issue : it comes from exercises, when some questions have "base64 images" pasted : images that have been pasted into questions (by ctrl-c => ctrl-v with Firefox browser). But there is no problem when images are saved "on the server" (or with "hotlinked pictures").

When the picture is integrated by this way, its "reference" in the url is very long (I presume it is saved as a data in the database) : The url as it appears in the "edit mode" of the question : Capture14

The question as it appears in the datebase with base64image : image data

I presume that the error 413 or "URL issue" comes from that point ?

What is surprinsing is that even when we don't want to copy the exercises with a "base64 issue", and select another section of the course, the problem can occurs (for ex. with a selection of some documents in documents section) : the only presence -into the same course- of one exercise with "problems" (due to some base64 images) is enough to disrupt the entire copying process, even when you do not want to copy the exercise in question.

But with a full copy of the course, there is never any issue ! Sometimes, it is the combination of two exercises with base64 that causes the bug (and sometimes, the same exercises considered in isolation do not cause any problem !).

To Reproduce Steps to reproduce the behavior:

  1. Go to the backup section 2- Select "Let me select learning objects" (whatever you select, the problem can occurs) 3- Start the process... and it can fail, depending of the combination of exercises presenting the problem (if some exercises with base64 images are present in the exercises section)

Expected behavior The copy of some objects should work as perfectly as the full copy of the course (it's a weird situation : when we want to copy just some small parts of a course we have a "Request entity too large..." error, but not when we want to copy the full course :-)).

**Server

Desktop (please complete the following information): No "base64 issue" with Edge or Chrome (because the image pasting bt ctrl+v is desactivated). Only Firefox seems to offer this possibilty to paste images as base64 format. I don't use IE or Safari.

Additional context I made some tests on 11.chamilo.org. See here from this course (anything you want to copy, it fails because of exercises with base64 images) : cours tanchon. The difference with my platform is that the copy process fails, without any message : Chamilo returns to the copy_course menu : see below, (without any other action).

I tried to desactivate pasting of images with Firefox, in order to avoid base64 images : i created a Ckeditor plugin (see here for example) but it didn't work !

Tanchon.

Here is the menu that 11.chamilo.org displays after failure with course copy process : 10000

tanchon commented 4 years ago

Hi,

Here, is what my logs tell me when i try to copy some exercises from one course to another (first, the most recent): each error begin with "fast cgi server..."

[Sun Jun   07 14:12:07.820668 2020] Course copy generated an ignorable error while trying to   copy   /home/clients/5c47438a0195cf2bb7/web/app/courses/QCM/document/../exercises/0/1/202/3//1-0-3-1-202-577.ogg   to   /home/clients/5c47438a0195cf2bb7b/web/app/courses/TEST/document/../exercises/0/1/202/3:   destination directory not writable, referer:   https://xxxxx.fr/main/coursecopy/copy_course.php?cidReq=QCM&id_session=0&gidReq=0&gradebook=0&origin=
--
[Sun Jun   07 14:12:07.820661 2020] [:error] Course copy generated an ignorable error while trying to   copy /home/clients/5c47438a0195cf2bb7b/web/app/courses/QCM/document/../exercises/0/1/202/3//1-0-3-1-202-577.ogg   to   /home/clients/5c47438a0195cf2bb7b/web/app/courses/TEST/document/../exercises/0/1/202/3:   destination directory not found, referer:   https://xxxxx.fr/main/coursecopy/copy_course.php?cidReq=QCM&id_session=0&gidReq=0&gradebook=0&origin=

[Sun Jun   07 14:12:07.820653 2020] [:error]  Course copy generated an ignorable error while trying to   copy   /home/clients/5c47438a0195cf2bb7b/web/app/courses/QCM/document/../exercises/0/1/202/3//1-0-3-1-202-1446.ogg   to /home/clients/5c47438a0195cf2bb7b/web/app/courses/TEST/document/../exercises/0/1/202/3:   destination directory not writable, referer:   https://xxxxx.fr/main/coursecopy/copy_course.php?cidReq=QCM&id_session=0&gidReq=0&gradebook=0&origin=

[Sun Jun   07 14:12:07.820551 2020] [:error] Course copy generated an ignorable error while trying to   copy   /home/clients/5c47438a0195cf2bb7b/web/app/courses/QCM/document/../exercises/0/1/202/3//1-0-3-1-202-1446.ogg   to   /home/clients/5c47438a0195cf2bb7b/web/app/courses/TEST/document/../exercises/0/1/202/3:   destination directory not found, referer:   https://xxxxx.fr/main/coursecopy/copy_course.php?cidReq=QCM&id_session=0&gidReq=0&gradebook=0&origin=
tanchon commented 4 years ago

Hi,

I can confirm that the issue comes from "base64 images", because :

=> I took a course with the 413 error when trying to copy a some parts of it => I changed all "base64 images" : i replaced it by images saved "on the server" (in "my files"). => I tried to copy some parts of the course : it works perfectly !

What remains strange, from my point of view is that when trying to copy the full course there is never any issue, whatever the way the images was saved (another strange thing is that even when we didn't select any exercise with "corrupted base64 images", the error 413 occured).

Tanchon

PS : i don't know why my logs told me there was a problem with an ogg file because before changing the picture as describe above, i have deleted the ogg files and it didn't solved the 413 error (the problem come from base64 images, not from ogg file).

tanchon commented 4 years ago

Hi,

It seems that into a course, when a teacher wants to copy an exercise that causes a "413 error" with the copy course process, there is no problem (as the full backup of a course from one course to another).

That confirm that there is an issue with the course copy processs with the "Let me select learning objects" option.

Tanchon.

ywarnier commented 4 years ago

Hi @tanchon Thanks for reporting. This really looks like an edge case that only happens to one in 10.000 cases. I accept the submission of this issue, but this is veeeeery low on our priorities list :-)