ftp: fix error in dir() (#8504)

pull/8511/head
yuyi 2021-02-02 15:22:52 +08:00 committed by GitHub
parent 9a2820fa7b
commit 5ec6f7a781
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -67,7 +67,9 @@ mut:
}
pub fn new() FTP {
mut f := FTP{ conn: 0 }
mut f := FTP{
conn: 0
}
f.buffer_size = 1024
return f
}
@ -220,7 +222,7 @@ pub fn (mut zftp FTP) dir() ?[]string {
for lfile in sdir.split('\n') {
if lfile.len > 1 {
spl := lfile.split(' ')
dir << spl[spl.len - 1]
dir << spl[spl.len - 1].trim_space()
}
}
return dir

View File

@ -41,6 +41,7 @@ fn ftp_client_test_inside() ? {
return
}
assert dir_list2.len > 0
assert dir_list2.contains('katello-host-tools-3.3.5-8.sles11_4sat.src.rpm')
blob := zftp.get('katello-host-tools-3.3.5-8.sles11_4sat.src.rpm') or {
assert false
return