Remove useless assignation

This commit is contained in:
Bubka 2020-11-22 12:26:20 +01:00
parent 742107a270
commit fa90fb0867

View File

@ -48,10 +48,10 @@ public function store(Request $request)
]);
// Two possible cases :
// - The most common case, the uri is provided thanks to a QR code live scan or file upload
// - The most common case, the uri is provided by the QuickForm, thanks to a QR code live scan or file upload
// -> We use this uri to populate the account
// - The advanced form has been used and provide no uri but all individual parameters
// -> We use the parameters collection to populate the account
// -> We use the parameters array to populate the account
$twofaccount = new TwoFAccount;
$twofaccount->service = $request->service;
$twofaccount->account = $request->account;
@ -139,11 +139,11 @@ public function preview(Request $request)
// If present, use the imageLink parameter to prefill the icon field
if( $twofaccount->imageLink ) {
$chunks = explode('.', $twofaccount->imageLink);
$hashFilename = Str::random(40) . '.' . end($chunks);
try {
$chunks = explode('.', $twofaccount->imageLink);
$hashFilename = Str::random(40) . '.' . end($chunks);
Storage::disk('local')->put('imagesLink/' . $hashFilename, file_get_contents($twofaccount->imageLink));
if( in_array(Storage::mimeType('imagesLink/' . $hashFilename), ['image/png', 'image/jpeg', 'image/webp', 'image/bmp']) ) {
@ -155,7 +155,7 @@ public function preview(Request $request)
}
}
catch( \Exception $e ) {
$twofaccount->imageLink = null;
// do nothing
}
}