Skip to content

Commit

Permalink
Fix an issue when a module could not be updated due to existing Publi…
Browse files Browse the repository at this point in the history
…c symlink - closes #2709
  • Loading branch information
freescout-help-desk committed Feb 16, 2023
1 parent 4eadecc commit 9dfad3b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/Http/Controllers/ModulesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,18 @@ public function ajax(Request $request)
} else {
// Extract
try {
// Sometimes by some reason Public folder becomes a symlink leading to itself.
// It causes an error during updating process.
// https://github.com/freescout-helpdesk/freescout/issues/2709
$public_folder = $module->getPath().DIRECTORY_SEPARATOR.'Public';
try {
if (is_link($public_folder)) {
unlink($public_folder);
}
} catch (\Exception $e) {
// Do nothing.
}

\Helper::unzip($module_archive, \Module::getPath());
} catch (\Exception $e) {
// We will show this as floating message on page reload
Expand Down

0 comments on commit 9dfad3b

Please sign in to comment.