3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-05-12 17:45:31 +00:00

Requested changes

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe
2025-06-27 12:37:11 +01:00
parent aafc8996c1
commit e0f5663bf4
3 changed files with 5 additions and 8 deletions

View File

@ -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);
}

View File

@ -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') {

View File

@ -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',