mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 14:27:33 -08:00
Fixes #5422 - remove extension ending from uploaded file name
This commit is contained in:
parent
8127484081
commit
1708bb5cdf
|
@ -953,8 +953,7 @@ class AssetsController extends Controller
|
|||
if ($request->hasFile('assetfile')) {
|
||||
foreach ($request->file('assetfile') as $file) {
|
||||
$extension = $file->getClientOriginalExtension();
|
||||
$filename = 'hardware-'.$asset->id.'-'.str_random(8);
|
||||
$filename .= '-'.str_slug($file->getClientOriginalName()).'.'.$extension;
|
||||
$filename = 'hardware-'.$asset->id.'-'.str_random(8).'-'.str_slug(basename($file->getClientOriginalName(), '.'.$extension)).'.'.$extension;
|
||||
$file->move($destinationPath, $filename);
|
||||
$asset->logUpload($filename, e(Input::get('notes')));
|
||||
}
|
||||
|
@ -1331,7 +1330,7 @@ class AssetsController extends Controller
|
|||
try {
|
||||
$destinationPath = config('app.private_uploads').'/assets/audits';
|
||||
$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);
|
||||
} catch (\Exception $e) {
|
||||
\Log::error($e);
|
||||
|
|
Loading…
Reference in a new issue