Add mtime to receiving filename, so that we dont have name clashes with systems that use the same archive name for our host

This commit is contained in:
Deon George 2023-11-16 20:39:48 +11:00
parent 250e584c03
commit 67747c062a
3 changed files with 4 additions and 4 deletions

View File

@ -102,13 +102,13 @@ class File extends FileBase implements \Iterator
}
/**
* Return the name of the file, without a node ID prefix
* Return the name of the file, without a node ID, mtime prefix
*
* @return string
*/
public function rawName(): string
{
return preg_replace('/^[0-9A-F]{4}-/','',$this->getFilename());
return preg_replace('/^[0-9A-F]{4}-([0-9]+)-]/','',$this->getFilename());
}
/**

View File

@ -36,7 +36,7 @@ final class Item extends Receive
return Storage::disk(config('fido.local_disk'))->exists($this->rel_name);
case 'pref_name':
return sprintf('%04X-%s',$this->ao->id,$this->recvas);
return sprintf('%04X-%d-%s',$this->ao->id,$this->recvmtime,$this->recvas);
case 'rel_name':
return sprintf('%s/%s',config('fido.dir'),$this->pref_name);
case 'full_name':

View File

@ -49,7 +49,7 @@ class PacketProcess extends Command
if ($this->argument('ftn')) {
$a = Address::findFTN($this->argument('ftn'));
} elseif (preg_match('/^(([0-9]+)-)+/',$this->argument('file'),$m)) {
} elseif (preg_match('/^(([0-9A-F]+)-([0-9]+))+/',$this->argument('file'),$m)) {
$a = Address::findOrFail(hexdec($m[2]));
} else {