mirror of
https://github.com/snipe/snipe-it.git
synced 2026-05-12 17:45:31 +00:00
@ -187,8 +187,8 @@ class UploadedFilesController extends Controller
|
||||
}
|
||||
|
||||
|
||||
// Check that the file being requested exists for the asset
|
||||
if (! $log = Actionlog::whereNotNull('filename')->where('item_type', AssetModel::class)->where('item_id', $object->id)->find($file_id)
|
||||
// Check that the file being requested exists for the object
|
||||
if (! $log = Actionlog::whereNotNull('filename')->where('item_type', self::$map_object_type[$object_type])->where('item_id', $object->id)->find($file_id)
|
||||
) {
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, trans('general.file_upload_status.invalid_id')), 200);
|
||||
}
|
||||
|
||||
@ -42,7 +42,8 @@ class UploadFileRequest extends Request
|
||||
public function handleFile(string $dirname, string $name_prefix, $file): string
|
||||
{
|
||||
|
||||
$file_name = $name_prefix.'-'.str_random(8).'-'.str_replace(' ', '-', $file->getClientOriginalName());
|
||||
$extension = $file->getClientOriginalExtension();
|
||||
$file_name = $name_prefix.'-'.str_random(8).'-'.str_slug(basename($file->getClientOriginalName(), '.'.$extension)).'.'.$file->guessExtension();
|
||||
|
||||
// Check for SVG and sanitize it
|
||||
if ($file->getMimeType() === 'image/svg+xml') {
|
||||
|
||||
@ -12,13 +12,9 @@ class UploadsPresenter extends Presenter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function dataTableLayout($object)
|
||||
public static function dataTableLayout()
|
||||
{
|
||||
|
||||
if ($object =='assets') {
|
||||
$object = 'hardware';
|
||||
}
|
||||
|
||||
$layout = [
|
||||
[
|
||||
'field' => 'id',
|
||||
|
||||
Reference in New Issue
Block a user