-
Bug
-
Resolution: Fixed
-
Minor
-
2.7.14, 3.1, 3.4
-
MOODLE_27_STABLE, MOODLE_31_STABLE, MOODLE_34_STABLE
-
MOODLE_33_STABLE, MOODLE_34_STABLE
-
MDL-54967-master -
I have an IMS Common Cartridge course backup from Canvas. I have validated it here:
http://validator.imsglobal.org/cc/index.jsp?validate=cartridge
When I try to restore it to Moodle, the import fails with the following error message:
error/
Fatal Error in [tempdir]/backup/5d39251534af9adb46e401f27f517662/moodle.xml: EntityRef: expecting ';' at line 221
When Moodle creates "moodle.xml", it is incorrectly decoding html entities in the URL. This makes the XML parser choke when it encounters an ampersand, because it expects this to be the start of an entity reference.
The workaround is to change cc11_resource::create_node_course_modules_mod_resource() in backup/cc/entity11.resource.class.php as follows:
diff --git a/backup/cc/entity11.resource.class.php b/backup/cc/entity11.resource.class.php
|
index bc5bb5a..d383352 100644
|
--- a/backup/cc/entity11.resource.class.php
|
+++ b/backup/cc/entity11.resource.class.php
|
@@ -99,7 +99,7 @@ class cc11_resource extends entities11 {
|
$link = 'http://invalidurldetected/';
|
}
|
} else {
|
- $link = $rawlink;
|
+ $link = htmlentities($rawlink);
|
}
|
}
|
}
|
(I am absolutely certain this is the wrong approach, by the way. It's only a workaround)