Skip to content

Commit

Permalink
BUGFIX: Fix nasty bug with case sensitive file systems
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastian Heist committed Feb 21, 2019
1 parent 10aa296 commit 6405bdb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Classes/H5PAdapter/Core/FileAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,15 @@ public function moveContentDirectory($source, $contentId = null)
$h5pJson = $this->getContent($source . DIRECTORY_SEPARATOR . 'h5p.json');
$contentJson = $this->getContent($contentSource . DIRECTORY_SEPARATOR . 'content.json');

/**
* !!HACK!!: Unfortunately, imported persistent resources always have lowercase file endings.
* In case sensitive file systems, uploaded pictures with uppercase endings do not work.
* Our only option is to replace them into lowercase. Ew!
*/
$contentJson = preg_replace_callback('/"images.*\.(.*)"/U', function ($matches) {
return str_replace($matches[1], strtolower($matches[1]), $matches[0]);
}, $contentJson);

return (object)array(
'h5pJson' => $h5pJson,
'contentJson' => $contentJson
Expand Down

0 comments on commit 6405bdb

Please sign in to comment.