mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-09-21 19:47:21 +03:00
Fix symlink transmission
This commit is contained in:
parent
c4b3723372
commit
950edb1110
@ -539,7 +539,7 @@ def __init__(self, ftc: FileTransmissionCommand):
|
||||
self.ttype = ftc.ttype
|
||||
self.waiting_for_signature = True if self.ttype is TransmissionType.rsync else False
|
||||
self.transmitted = False
|
||||
self.stat = os.stat(self.path)
|
||||
self.stat = os.stat(self.path, follow_symlinks=False)
|
||||
if stat.S_ISDIR(self.stat.st_mode):
|
||||
raise TransmissionError(ErrorCode.EINVAL, msg='Cannot send a directory', file_id=self.file_id)
|
||||
self.compressor: Union[ZlibCompressor, IdentityCompressor] = IdentityCompressor()
|
||||
|
@ -190,6 +190,8 @@ def test_file_get(self):
|
||||
data = os.urandom(16 * 1024)
|
||||
with open(src, 'wb') as f:
|
||||
f.write(data)
|
||||
sl = os.path.join(base, 'src.link')
|
||||
os.symlink(src, sl)
|
||||
for compress in ('none', 'zlib'):
|
||||
ft = FileTransmission()
|
||||
self.responses = []
|
||||
@ -203,6 +205,10 @@ def test_file_get(self):
|
||||
if compress == 'zlib':
|
||||
received = ZlibDecompressor()(received, True)
|
||||
self.ae(data, received)
|
||||
ft.test_responses = []
|
||||
ft.handle_serialized_command(serialized_cmd(action='file', file_id='sl', name=sl, compression=compress))
|
||||
received = b''.join(x['data'] for x in ft.test_responses)
|
||||
self.ae(received.decode('utf-8'), src)
|
||||
|
||||
def test_file_put(self):
|
||||
# send refusal
|
||||
|
Loading…
Reference in New Issue
Block a user