Fix Address::parseFTN when matching addresses with 0's, minor cosmetic fixes, test subjects < 72 chars

This commit is contained in:
Deon George 2021-07-01 21:56:55 +10:00
parent 16a1d8a440
commit 88d189110d
4 changed files with 5 additions and 5 deletions

View File

@ -68,7 +68,7 @@ class Message extends FTNBase
private const USER_FROM_LEN = 36; // FTS-0001.016 From Name: upto 36 chars null terminated
private const USER_TO_LEN = 36; // FTS-0001.016 To Name: upto 36 chars null terminated
private const SUBJECT_LEN = 72; // FTS-0001.016 Subject: upto 72 chars null terminated
private const SUBJECT_LEN = 71; // FTS-0001.016 Subject: upto 72 chars null terminated
private const AREATAG_LEN = 35; //
private ?ValidatorResult $errors = NULL; // Packet validation

View File

@ -130,11 +130,11 @@ class Address extends Model
// Check our numbers are correct.
foreach ([1,2,3] as $i) {
if (! $matches[$i] || ($matches[$i] > DomainController::NUMBER_MAX))
if ((! is_numeric($matches[$i])) || ($matches[$i] > DomainController::NUMBER_MAX))
throw new Exception('Invalid FTN: '.$ftn);
}
if (isset($matches[5]) AND $matches[5] > DomainController::NUMBER_MAX)
if (isset($matches[5]) AND ((! is_numeric($matches[$i])) || ($matches[5] > DomainController::NUMBER_MAX)))
throw new Exception('Invalid FTN: '.$ftn);
return [

View File

@ -34,6 +34,6 @@
form.classList.add('was-validated')
}, false)
})
});
})()
</script>

View File

@ -39,7 +39,7 @@ use App\Models\Setup;
@else
A system is required.
@enderror
</span>
</span>
<span class="input-helper">Add a <a href="{{ url('ftn/system/addedit') }}">NEW System</a></span>
</div>
</div>