Fix for bug introduced in previous commit, where tic files where queued without the address prefix

This commit is contained in:
Deon George 2023-09-05 20:41:41 +12:00
parent 3cd0deada0
commit 63a9c06fb0
5 changed files with 15 additions and 8 deletions

View File

@ -133,11 +133,15 @@ class Tic extends FTNBase
{ {
Log::info(sprintf('%s:Processing TIC file [%s]',self::LOGKEY,$filename)); Log::info(sprintf('%s:Processing TIC file [%s]',self::LOGKEY,$filename));
if (str_contains($filename,'-')) {
list($hex,$name) = explode('-',$filename); list($hex,$name) = explode('-',$filename);
$hex = basename($hex); $hex = basename($hex);
} else {
$hex = '';
}
if (! file_exists($filename)) if (! file_exists($filename))
throw new FileNotFoundException(sprintf('%s:File [%s] doesnt exist',self::LOGKEY,realpath($filename))); throw new FileNotFoundException(sprintf('%s:File [%s] doesnt exist',self::LOGKEY,$filename));
if (! is_readable($filename)) if (! is_readable($filename))
throw new UnableToWriteFile(sprintf('%s:File [%s] is not readable',self::LOGKEY,realpath($filename))); throw new UnableToWriteFile(sprintf('%s:File [%s] is not readable',self::LOGKEY,realpath($filename)));

View File

@ -25,7 +25,7 @@ use Illuminate\Support\Collection;
* + sendas (nameas) is filename only * + sendas (nameas) is filename only
* *
* For receiving, we just received files, and based on its name, we determine if it is a mail/file/tic or request * For receiving, we just received files, and based on its name, we determine if it is a mail/file/tic or request
* When receiving, we receive one file at a time, and our list has the list of files we've recevied * When receiving, we receive one file at a time, and our list has the list of files we've received
* *
* + name our name (including path) with the address ID prefixed of the sender * + name our name (including path) with the address ID prefixed of the sender
* + size is advised to us by the remote * + size is advised to us by the remote

View File

@ -36,8 +36,10 @@ final class Item extends Receive
case 'exists': case 'exists':
return Storage::disk(self::LOCATION)->exists($this->rel_name); return Storage::disk(self::LOCATION)->exists($this->rel_name);
case 'stor_name':
return sprintf('%04X-%s',$this->ao->id,$this->recvas);
case 'rel_name': case 'rel_name':
return sprintf('%s/%04X-%s',config('app.fido'),$this->ao->id,$this->recvas); return sprintf('%s/%s',config('app.fido'),$this->stor_name);
case 'full_name': case 'full_name':
return Storage::disk(self::LOCATION)->path($this->rel_name); return Storage::disk(self::LOCATION)->path($this->rel_name);

View File

@ -63,6 +63,7 @@ class Receive extends Base
case 'nameas': case 'nameas':
case 'size': case 'size':
case 'name_size_time': case 'name_size_time':
case 'stor_name':
return $this->receiving->{$key}; return $this->receiving->{$key};
case 'pos': case 'pos':
@ -215,7 +216,7 @@ class Receive extends Base
Log::info(sprintf('%s:- Processing TIC file [%s]',self::LOGKEY,$this->receiving->nameas)); Log::info(sprintf('%s:- Processing TIC file [%s]',self::LOGKEY,$this->receiving->nameas));
// Queue the tic to be processed later, in case the referenced file hasnt been received yet // Queue the tic to be processed later, in case the referenced file hasnt been received yet
TicProcess::dispatch($this->receiving->nameas); TicProcess::dispatch($this->receiving->rel_name);
break; break;

View File

@ -57,11 +57,11 @@ class TicProcess implements ShouldQueue
public function handle() public function handle()
{ {
$to = new Tic; $to = new Tic;
$to->load($this->file); $to->load(storage_path('app').$this->file);
Log::info(sprintf('%s:Processed [%s] storing [%s] as id [%d]',self::LOGKEY,$this->file,$to->fo->file,$to->fo->id)); Log::info(sprintf('%s:Processed [%s] storing [%s] as id [%d]',self::LOGKEY,$this->file,$to->fo->file,$to->fo->id));
unlink($this->file); unlink(storage_path('app').$this->file);
if ($to->isNodelist()) if ($to->isNodelist())
NodelistImport::dispatch($to->fo,$this->domain); NodelistImport::dispatch($to->fo,$this->domain);