code fixes

This commit is contained in:
Dennis Eichhorn 2024-03-15 20:24:38 +00:00
parent 38565605f7
commit d937e54ff1
2 changed files with 17 additions and 13 deletions

View File

@ -83,6 +83,9 @@ final class ApiController extends Controller
public function apiMediaEmailSend(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
$email = $request->getDataString('email');
if (empty($email)) {
return;
}
$media = $data['media'] ?? MediaMapper::get()
->where('id', (int) $request->getData('id'))
@ -522,7 +525,7 @@ final class ApiController extends Controller
case 'tiff':
case 'webp':
case 'bmp':
$ocr = new TesseractOcr();
$ocr = new TesseractOcr();
return $ocr->parseImage($path);
case 'doc':
@ -980,13 +983,13 @@ final class ApiController extends Controller
$virtualPath = \trim($path, '/');
$virtualPaths = \explode('/', $virtualPath);
$tempVirtualPaths = $virtualPaths;
$length = \count($virtualPaths);
$length = \count($virtualPaths);
/** @var Collection $parentCollection */
$parentCollection = null;
$virtual = '';
$real = '';
$virtual = '';
$real = '';
$newVirtual = '';
for ($i = $length; $i > 0; --$i) {
@ -1143,7 +1146,8 @@ final class ApiController extends Controller
$media->setVirtualPath(\dirname($path));
$media->setPath('/' . \ltrim($path, '\\/'));
} else {
$media = MediaMapper::getAll()
/** @var Media $media */
$media = MediaMapper::get()
->where('virtualPath', $path)
->limit(1)
->execute();

View File

@ -72,10 +72,10 @@ final class SearchController extends Controller
'link' => '{/base}/media/view?id=' . $file->id,
'account' => '',
'createdAt' => $file->createdAt,
'image' => '',
'tags' => $file->tags,
'type' => 'list_links',
'module' => 'Media',
'image' => '',
'tags' => $file->tags,
'type' => 'list_links',
'module' => 'Media',
];
}
@ -121,10 +121,10 @@ final class SearchController extends Controller
'link' => '{/base}/media/view?id=' . $file->id,
'account' => '',
'createdAt' => $file->createdAt,
'image' => '',
'tags' => $file->tags,
'type' => 'list_links',
'module' => 'Media',
'image' => '',
'tags' => $file->tags,
'type' => 'list_links',
'module' => 'Media',
];
}