1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

net.ftp: fix dir() for file names, which contain spaces (fix #18800) (#18804)

This commit is contained in:
okk 2023-07-07 03:50:20 +00:00 committed by GitHub
parent ded6c38061
commit 7d6e15fa66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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