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')) {
|
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')));
|
||||||
}
|
}
|
||||||
|
@ -1331,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);
|
||||||
|
|
Loading…
Reference in a new issue