From 76dc90ceb318371bc789b7573b065ffe70681344 Mon Sep 17 00:00:00 2001 From: Deon George Date: Thu, 23 Nov 2023 13:17:02 +1100 Subject: [PATCH] Fixes to TIC processing that uses the Address::ftn_regex --- app/Models/File.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/Models/File.php b/app/Models/File.php index 5725913..7cd30ba 100644 --- a/app/Models/File.php +++ b/app/Models/File.php @@ -87,9 +87,13 @@ class File extends Model $zone = $model->fftn->zone; // Parse PATH + /** + * Path 21:4/106.0 @231005001126 PST+7 Foobar + * Path 21:1/100 1696489954 Thu Oct 05 07:12:34 2023 UTC htick/lnx 1.9 2022-07-03 + */ foreach ($model->set_path as $line) { $matches = []; - preg_match(sprintf('#^(\d+:\d+/\d+(\.\d+)?(@%s)?)\ ((\d+)\ )?(.*)$#',Address::ftn_regex),$line,$matches); + preg_match(sprintf('#^(%s)\ ((@?)(\d+)(\ ([A-Z]{3}([\+\-][0-9]+)))?)\ ?(.*)$#',Address::ftn_regex),$line,$matches); if ($x=Arr::get($matches,1)) { $ftn = Address::parseFTN($x); @@ -102,7 +106,11 @@ class File extends Model if (! $ao) $ao = Address::createFTN($x,System::createUnknownSystem()); - $path->push(['address'=>$ao,'datetime'=>Carbon::createFromTimestamp($matches[12]),'extra'=>$matches[13]]); + $datetime = ($matches[8] === '@') + ? Carbon::createFromFormat('ymdHis',$matches[9],$matches[12]) + : Carbon::createFromTimestamp($matches[7]); + + $path->push(['address'=>$ao,'datetime'=>$datetime,'extra'=>$matches[13]]); } }