diff options
author | Devian <devianleong@gmail.com> | 2021-04-30 15:18:38 +0800 |
---|---|---|
committer | Devian <devianleong@gmail.com> | 2021-04-30 15:18:38 +0800 |
commit | 60b400a2a3e4b9838d52fb91a427b905932dcb2a (patch) | |
tree | 5dc77dc2bef56e3de9d93becd6c7650a82d339c9 /src | |
parent | a6419144cf2fa952b9b063a20f3d4dc956ffe3e9 (diff) |
Fixed scorm extract path1.0.7
Diffstat (limited to 'src')
-rw-r--r-- | src/Manager/ScormManager.php | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/Manager/ScormManager.php b/src/Manager/ScormManager.php index 30d0322..af737d1 100644 --- a/src/Manager/ScormManager.php +++ b/src/Manager/ScormManager.php @@ -172,11 +172,11 @@ class ScormManager $destinationDir = $rootFolder.$hashName; // file path - if (!File::isDirectory($rootFolder.$destinationDir)) { - File::makeDirectory($rootFolder.$destinationDir, 0755, true, true); + if (!File::isDirectory($destinationDir)) { + File::makeDirectory($destinationDir, 0755, true, true); } - $zip->extractTo($rootFolder.$destinationDir); + $zip->extractTo($destinationDir); $zip->close(); } @@ -196,11 +196,17 @@ class ScormManager throw new StorageNotFoundException(); } - $rootFolder = config('filesystems.disks.'.config('scorm.disk').'.root').'/'; - $destinationDir = config('scorm.upload_path').$hashName; // file path + $rootFolder = config('filesystems.disks.'.config('scorm.disk').'.root'); + + if (substr($rootFolder, -1) != '/') { + // If end with xxx/ + $rootFolder = config('filesystems.disks.'.config('scorm.disk').'.root').'/'; + } + + $destinationDir = $rootFolder.$hashName; // file path // Move Scorm archive in the files directory - $finalFile = $file->move($rootFolder.$destinationDir, $hashName.'.zip'); + $finalFile = $file->move($destinationDir, $hashName.'.zip'); return [ 'name' => $hashFileName, // to follow standard file data format |