diff --git a/Core/H5POptions.php b/Core/H5POptions.php index 5c77c52..42a2c0f 100644 --- a/Core/H5POptions.php +++ b/Core/H5POptions.php @@ -99,15 +99,23 @@ public function getUploadedH5pPath($set = null) public function getRelativeH5PPath() { - return "/". $this->getOption('storage_dir'); + $dir = $this->getOption('storage_dir'); + + return $dir[0] === '/' ? $dir : '/' . $dir; } public function getAbsoluteH5PPathWithSlash(){ - return $this->getAbsoluteWebPath() . '/' . $this->getOption('storage_dir') .'/'; + $dir = $this->getOption('storage_dir'); + $dir = $dir[0] === '/' ? $dir : '/' . $dir; + + return $this->getAbsoluteWebPath() . $dir .'/'; } public function getAbsoluteH5PPath() { - return $this->getAbsoluteWebPath() . '/' . $this->getOption('storage_dir'); + $dir = $this->getOption('storage_dir'); + $dir = $dir[0] === '/' ? $dir : '/' . $dir; + + return $this->getAbsoluteWebPath() . $dir; } public function getAbsoluteWebPath() diff --git a/Core/H5PSymfony.php b/Core/H5PSymfony.php index cd0cea0..2692e44 100644 --- a/Core/H5PSymfony.php +++ b/Core/H5PSymfony.php @@ -523,7 +523,7 @@ private function storeContent($contentData, Content $content) { $library = $this->manager->getRepository('StuditH5PBundle:Library')->find($contentData['library']['libraryId']); $content->setLibrary($library); - $content->setParameters($contentData['params']); + $content->setParameters(str_replace('#tmp','', $contentData['params'])); $content->setDisabledFeatures($contentData['disable']); $content->setFilteredParameters(null); $this->manager->persist($content); diff --git a/DependencyInjection/StuditH5PExtension.php b/DependencyInjection/StuditH5PExtension.php index b77f7cf..5d5b5cb 100644 --- a/DependencyInjection/StuditH5PExtension.php +++ b/DependencyInjection/StuditH5PExtension.php @@ -25,7 +25,10 @@ public function load(array $configs, ContainerBuilder $container) $loader->load('services.yml'); /** @var $definition Definition **/ $definition = $container->getDefinition("studit_h5p.core"); - $definition->setArgument(1, $container->getParameter('kernel.project_dir') . '/' . $config['web_dir'] . '/' . $config["storage_dir"]); + $dir = $config["storage_dir"]; + $dir[0] === '/' ? $dir : '/' . $dir; + + $definition->setArgument(1, $container->getParameter('kernel.project_dir') . '/' . $config['web_dir'] . $dir); $definition->setArgument(2, '/'); $definition->setArgument(3, 'en'); $definition->setArgument(4, true); diff --git a/Editor/LibraryStorage.php b/Editor/LibraryStorage.php index 1547a3e..7f5b9e2 100644 --- a/Editor/LibraryStorage.php +++ b/Editor/LibraryStorage.php @@ -65,7 +65,7 @@ public function storeLibraryData($library, $parameters, Content $content = null) if (!$content){ $contentData['id'] = $contentId; } - $this->updateLibraryFiles($contentId, $contentData, $oldLibrary, $oldParameters); + $this->updateLibraryFiles($contentId, $contentData, $oldLibrary, $oldParameters->params ?? null); return $contentId; } private function updateLibraryFiles($contentId, $contentData, $oldLibrary, $oldParameters)