Dont abort a session when there is an invalid FTN presented
This commit is contained in:
@@ -9,6 +9,7 @@ use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\FTN\{Message,Packet};
|
||||
use App\Exceptions\InvalidFTNException;
|
||||
use App\Http\Controllers\DomainController;
|
||||
use App\Traits\ScopeActive;
|
||||
|
||||
@@ -821,16 +822,16 @@ class Address extends Model
|
||||
public static function parseFTN(string $ftn): array
|
||||
{
|
||||
if (! preg_match(sprintf('#^%s$#',self::ftn_regex),strtolower($ftn),$matches))
|
||||
throw new \Exception('Invalid FTN: '.$ftn);
|
||||
throw new InvalidFTNException(sprintf('Invalid FTN: %s - regex failed',$ftn));
|
||||
|
||||
// Check our numbers are correct.
|
||||
foreach ([1,2,3] as $i) {
|
||||
if ((! is_numeric($matches[$i])) || ($matches[$i] > DomainController::NUMBER_MAX))
|
||||
throw new \Exception('Invalid FTN: '.$ftn);
|
||||
throw new InvalidFTNException(sprintf('Invalid FTN: %s - zone, host or node address invalid',$ftn));
|
||||
}
|
||||
|
||||
if (isset($matches[5]) AND ((! is_numeric($matches[$i])) || ($matches[5] > DomainController::NUMBER_MAX)))
|
||||
throw new \Exception('Invalid FTN: '.$ftn);
|
||||
throw new InvalidFTNException(sprintf('Invalid FTN: %s - point address invalid',$ftn));
|
||||
|
||||
return [
|
||||
'z'=>(int)$matches[1],
|
||||
|
Reference in New Issue
Block a user