Skip to content
This repository was archived by the owner on Aug 22, 2021. It is now read-only.

Commit 467b483

Browse files
committed
🐛 Bugfix.
1 parent 8c0084a commit 467b483

File tree

4 files changed

+17
-37
lines changed

4 files changed

+17
-37
lines changed

src/StorageManager.php

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,18 @@ public function upload(Request $request)
5757

5858
$filename = $this->getFilename($file, $config);
5959

60-
try {
61-
$this->store($file, $filename);
62-
$response = [
63-
'state' => 'SUCCESS',
64-
'url' => $this->disk->url($filename),
65-
'title' => $filename,
66-
'original' => $file->getClientOriginalName(),
67-
'type' => $file->getExtension(),
68-
'size' => $file->getSize(),
69-
];
60+
$this->store($file, $filename);
61+
62+
$response = [
63+
'state' => 'SUCCESS',
64+
'url' => $this->disk->url($filename),
65+
'title' => $filename,
66+
'original' => $file->getClientOriginalName(),
67+
'type' => $file->getExtension(),
68+
'size' => $file->getSize(),
69+
];
7070

71-
return response()->json($response);
72-
} catch (StoreErrorException $e) {
73-
return $this->error($e->getMessage());
74-
}
71+
return response()->json($response);
7572
}
7673

7774
/**
@@ -84,7 +81,7 @@ public function upload(Request $request)
8481
*
8582
* @return Response
8683
*/
87-
protected function listFiles($path, $start, $size = 20, array $allowFiles = [])
84+
public function listFiles($path, $start, $size = 20, array $allowFiles = [])
8885
{
8986
$files = $this->paginateFiles($this->disk->listContents($path, true), $start, $size);
9087

@@ -107,7 +104,7 @@ protected function listFiles($path, $start, $size = 20, array $allowFiles = [])
107104
*/
108105
protected function paginateFiles(array $files, $start = 0, $size = 50)
109106
{
110-
return collect($files)->skip($start)->take($size)->map(function ($file) {
107+
return collect($files)->where('type', 'file')->splice($start)->take($size)->map(function ($file) {
111108
return [
112109
'url' => $this->disk->url($file['path']),
113110
'mtime' => $file['timestamp'],

src/StoreErrorException.php

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/UEditorController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class UEditorController extends Controller
2020
public function serve(Request $request)
2121
{
2222
$upload = config('ueditor.upload');
23-
$storage = app()->make('ueditor.storage');
23+
$storage = app('ueditor.storage');
2424

2525
switch ($request->get('action')) {
2626
case 'config':

src/UEditorServiceProvider.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ public function boot(Router $router)
4141
__DIR__.'/translations' => base_path('resources/lang/vendor/ueditor'),
4242
], 'resources');
4343

44-
$this->registerRoute($router);
44+
if (!app()->runningInConsole()) {
45+
$this->registerRoute($router);
46+
}
4547
}
4648

4749
/**

0 commit comments

Comments
 (0)