Fixed: Move event has only target directory as second argument
continuous-integration/drone/push Build encountered an error
Details
continuous-integration/drone/push Build encountered an error
Details
This commit is contained in:
parent
30bd3dc25f
commit
54fd872452
|
@ -78,11 +78,11 @@ class Plugin extends PluginBase
|
|||
|
||||
Event::listen('media.file.move', function($widget, $old, $new) {
|
||||
if ((new StorageMediaPath($new))->shouldProcess() || (new StorageMediaPath($old))->shouldProcess()) {
|
||||
Queue::push(MoveJob::class, [$old, $new], Setting::get('queue'));
|
||||
Queue::push(MoveJob::class, [$old, $new.'/'.pathinfo($old, PATHINFO_FILENAME)], Setting::get('queue'));
|
||||
}
|
||||
});
|
||||
Event::listen('media.file.rename', function($widget, $old, $new) {
|
||||
if ((new StorageMediaPath($old))->shouldProcess()) {
|
||||
if ((new StorageMediaPath($new))->shouldProcess() || (new StorageMediaPath($old))->shouldProcess()) {
|
||||
Queue::push(MoveJob::class, [$old, $new], Setting::get('queue'));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -27,7 +27,7 @@ class MoveTest extends TestCase
|
|||
$this->media->put('/pages/alt/test.jpg', UploadedFile::fake()->image('test.jpg', 100, 100)->get());
|
||||
UploadedFile::fake()->image('test.jpg', 100, 100)->storeAs('uploads/public/c/pages/alt', 'test-200x300.jpg', 'local');
|
||||
|
||||
Event::fire('media.file.move', [null, '/pages/alt/test.jpg', '/pages/neu/test.jpg']);
|
||||
Event::fire('media.file.move', [null, '/pages/alt/test.jpg', '/pages/neu']);
|
||||
|
||||
$this->assertFileCount(0, 'pages/alt');
|
||||
$this->assertHasFile('pages/neu/test-200x300.jpg');
|
||||
|
|
Loading…
Reference in New Issue