Skip to content

Commit

Permalink
Fix delete user template directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas De Keukelaere committed Oct 11, 2024
1 parent ba63e07 commit a4c1cc0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/Backend/Modules/Pages/Ajax/RemoveUploadedFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ public function execute(): void

$path = FRONTEND_FILES_PATH . '/Pages/' . $directory . '/' . $file;

if (!is_file($path)) {
$this->output(Response::HTTP_OK);

return;
}

$filesystem = new Filesystem();
if ($filesystem->exists($path)) {
$filesystem->remove($path);
Expand Down
4 changes: 2 additions & 2 deletions src/Backend/Modules/Pages/Js/Pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ jsBackend.pages.extras = {
)

// send a request to remove the old image if the old image doesn't have the same name
if (oldImage !== response.data) {
if (oldImage && oldImage !== response.data) {
$.ajax({
data: {
fork: {module: 'Pages', action: 'RemoveUploadedFile'},
Expand Down Expand Up @@ -1022,7 +1022,7 @@ jsBackend.pages.extras = {
)

// send a request to remove the old image if the old image doesn't have the same name
if (oldImage !== response.data) {
if (oldImage && oldImage !== response.data) {
$.ajax({
data: {
fork: {module: 'Pages', action: 'RemoveUploadedFile'},
Expand Down

0 comments on commit a4c1cc0

Please sign in to comment.