Use regex for received file evaluation. Fixes recording received packet names

This commit is contained in:
2023-11-23 23:17:13 +11:00
parent 455fed52ee
commit 0800c48928
5 changed files with 14 additions and 10 deletions

View File

@@ -7,6 +7,8 @@ use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Log;
use Symfony\Component\HttpFoundation\File\File as FileBase;
use App\Classes\FTN\Packet;
class File extends FileBase implements \Iterator
{
private const LOGKEY = 'F--';
@@ -108,7 +110,7 @@ class File extends FileBase implements \Iterator
*/
public function rawName(): string
{
return preg_replace('/^[0-9A-F]{4}-([0-9]+)-]/','',$this->getFilename());
return preg_replace(sprintf('/^%s\.pkt$/i',Packet::regex),'\3\4',$this->getFilename());
}
/**
@@ -129,7 +131,7 @@ class File extends FileBase implements \Iterator
return preg_replace('/.pkt$/i','',Arr::get(stream_get_meta_data($f),'uri'));
} else {
return $this->isPacket() ? preg_replace('/.pkt$/i','',$this->rawName()) : NULL;
return $this->isPacket() ? $this->rawName() : NULL;
}
}
}