From 7d6e15fa663f9821773a8feee572b60834baaedf Mon Sep 17 00:00:00 2001 From: okk Date: Fri, 7 Jul 2023 03:50:20 +0000 Subject: [PATCH] net.ftp: fix dir() for file names, which contain spaces (fix #18800) (#18804) --- vlib/net/ftp/ftp.v | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vlib/net/ftp/ftp.v b/vlib/net/ftp/ftp.v index daded1023e..c6ba89e96a 100644 --- a/vlib/net/ftp/ftp.v +++ b/vlib/net/ftp/ftp.v @@ -227,8 +227,14 @@ pub fn (mut zftp FTP) dir() ![]string { mut dir := []string{} sdir := list_dir.bytestr() for lfile in sdir.split('\n') { + if lfile.len > 56 { + dir << lfile#[56..lfile.len - 1] + continue + } if lfile.len > 1 { - dir << lfile.after(' ').trim_space() + trimmed := lfile.after(':') + dir << trimmed#[3..trimmed.len - 1] + continue } } return dir