mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 21:54:14 -08:00
Merge branch 'develop'
This commit is contained in:
commit
3ca9f5f389
|
@ -55,6 +55,7 @@ class ResetDemoSettings extends Command
|
||||||
$settings->ldap_enabled = 0;
|
$settings->ldap_enabled = 0;
|
||||||
$settings->full_multiple_companies_support = 1;
|
$settings->full_multiple_companies_support = 1;
|
||||||
$settings->alt_barcode = 'C128';
|
$settings->alt_barcode = 'C128';
|
||||||
|
$settings->skin = '';
|
||||||
$settings->email_domain = 'snipeitapp.com';
|
$settings->email_domain = 'snipeitapp.com';
|
||||||
$settings->email_format = 'filastname';
|
$settings->email_format = 'filastname';
|
||||||
$settings->username_format = 'filastname';
|
$settings->username_format = 'filastname';
|
||||||
|
|
|
@ -953,8 +953,7 @@ class AssetsController extends Controller
|
||||||
if ($request->hasFile('assetfile')) {
|
if ($request->hasFile('assetfile')) {
|
||||||
foreach ($request->file('assetfile') as $file) {
|
foreach ($request->file('assetfile') as $file) {
|
||||||
$extension = $file->getClientOriginalExtension();
|
$extension = $file->getClientOriginalExtension();
|
||||||
$filename = 'hardware-'.$asset->id.'-'.str_random(8);
|
$filename = 'hardware-'.$asset->id.'-'.str_random(8).'-'.str_slug(basename($file->getClientOriginalName(), '.'.$extension)).'.'.$extension;
|
||||||
$filename .= '-'.str_slug($file->getClientOriginalName()).'.'.$extension;
|
|
||||||
$file->move($destinationPath, $filename);
|
$file->move($destinationPath, $filename);
|
||||||
$asset->logUpload($filename, e(Input::get('notes')));
|
$asset->logUpload($filename, e(Input::get('notes')));
|
||||||
}
|
}
|
||||||
|
@ -1012,7 +1011,11 @@ class AssetsController extends Controller
|
||||||
if (isset($asset->id)) {
|
if (isset($asset->id)) {
|
||||||
$this->authorize('view', $asset);
|
$this->authorize('view', $asset);
|
||||||
|
|
||||||
$log = Actionlog::find($fileId);
|
if (!$log = Actionlog::find($fileId)) {
|
||||||
|
return response('No matching record for that asset/file', 500)
|
||||||
|
->header('Content-Type', 'text/plain');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$file = $log->get_src('assets');
|
$file = $log->get_src('assets');
|
||||||
|
|
||||||
|
@ -1022,17 +1025,22 @@ class AssetsController extends Controller
|
||||||
|
|
||||||
$filetype = Helper::checkUploadIsImage($file);
|
$filetype = Helper::checkUploadIsImage($file);
|
||||||
|
|
||||||
|
if (!file_exists($file)) {
|
||||||
|
return response('File '.$file.' not found on server', 404)
|
||||||
|
->header('Content-Type', 'text/plain');
|
||||||
|
}
|
||||||
|
|
||||||
if ($filetype) {
|
if ($filetype) {
|
||||||
$contents = file_get_contents($file);
|
if ($contents = file_get_contents($file)) {
|
||||||
return Response::make($contents)->header('Content-Type', $filetype);
|
return Response::make($contents)->header('Content-Type', $filetype);
|
||||||
}
|
}
|
||||||
|
return JsonResponse::create(["error" => "Failed validation: "], 500);
|
||||||
|
}
|
||||||
return Response::download($file);
|
return Response::download($file);
|
||||||
}
|
}
|
||||||
// Prepare the error message
|
|
||||||
$error = trans('admin/hardware/message.does_not_exist', compact('id'));
|
|
||||||
|
|
||||||
// Redirect to the hardware management page
|
// Redirect to the hardware management page
|
||||||
return redirect()->route('hardware.index')->with('error', $error);
|
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.does_not_exist', compact('id')));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1322,7 +1330,7 @@ class AssetsController extends Controller
|
||||||
try {
|
try {
|
||||||
$destinationPath = config('app.private_uploads').'/assets/audits';
|
$destinationPath = config('app.private_uploads').'/assets/audits';
|
||||||
$extension = $file->getClientOriginalExtension();
|
$extension = $file->getClientOriginalExtension();
|
||||||
$filename = 'audit-'.$asset->id.'-'.str_slug($file->getClientOriginalName()).'.'.$extension;
|
$filename = 'audit-'.$asset->id.'-'.str_slug(basename($file->getClientOriginalName(), '.'.$extension)).'.'.$extension;
|
||||||
$file->move($destinationPath, $filename);
|
$file->move($destinationPath, $filename);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Log::error($e);
|
\Log::error($e);
|
||||||
|
|
|
@ -24,8 +24,8 @@ class ImageUploadRequest extends Request
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'image' => 'mimes:png,gif,jpg,jpeg,svg|max:2000',
|
'image' => 'mimes:png,gif,jpg,jpeg,svg',
|
||||||
'avatar' => 'mimes:png,gif,jpg,jpeg,svg|max:2000',
|
'avatar' => 'mimes:png,gif,jpg,jpeg,svg',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ Create a User ::
|
||||||
{{-- Page content --}}
|
{{-- Page content --}}
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
<p> This is the account information you'll use to access the site for the first time. All fields are required. </p>
|
<p> This is the account information you'll use to access the site for the first time. </p>
|
||||||
|
|
||||||
<form action="{{ route('setup.user.save') }}" method="POST">
|
<form action="{{ route('setup.user.save') }}" method="POST">
|
||||||
{{ csrf_field() }}
|
{{ csrf_field() }}
|
||||||
|
|
Loading…
Reference in a new issue