Skip to content

Commit 05da8be

Browse files
committed
fix: fix file path fired in events of renaming & moving
1 parent 26400eb commit 05da8be

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/Controllers/ItemsController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ public function domove()
7373
abort(404);
7474
}
7575

76+
$old_path = $old_file->path();
77+
7678
if ($old_file->hasThumb()) {
7779
$new_file = $this->lfm->setName($item)->thumb()->dir($target);
7880
if ($is_directory) {
@@ -85,9 +87,9 @@ public function domove()
8587
$new_file = $this->lfm->setName($item)->dir($target);
8688
$this->lfm->setName($item)->move($new_file);
8789
if ($is_directory) {
88-
event(new FolderWasMoving($old_file->path(), $new_file->path()));
90+
event(new FolderWasMoving($old_path, $new_file->path()));
8991
} else {
90-
event(new FileWasMoving($old_file->path(), $new_file->path()));
92+
event(new FileWasMoving($old_path, $new_file->path()));
9193
}
9294
};
9395

src/Controllers/RenameController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public function getRename()
5555
event(new ImageIsRenaming($old_file->path(), $new_file));
5656
}
5757

58+
$old_path = $old_file->path();
59+
5860
if ($old_file->hasThumb()) {
5961
$this->lfm->setName($old_name)->thumb()
6062
->move($this->lfm->setName($new_name)->thumb());
@@ -64,9 +66,9 @@ public function getRename()
6466
->move($this->lfm->setName($new_name));
6567

6668
if ($is_directory) {
67-
event(new FolderWasRenamed($old_file->path(), $new_file));
69+
event(new FolderWasRenamed($old_path, $new_file));
6870
} else {
69-
event(new ImageWasRenamed($old_file->path(), $new_file));
71+
event(new ImageWasRenamed($old_path, $new_file));
7072
}
7173

7274
return parent::$success_response;

0 commit comments

Comments
 (0)