Skip to content

File without any flags is not listed by ls #52

@np422

Description

@np422

Henlo!

A curious case, a file without any flags set won't be listed by the ls method of the sambal client.

Some of the information below have been redacted to protect the innocent.

smbclient -I prd-db-w01 -U XXXX YYYY .....
cd /some/strange/path
smb: \some\strange\path\ > ls
  .                                   D        0  Wed Nov  3 10:22:12 2021
  ..                                  D        0  Wed Nov  3 10:21:57 2021
  ID_84389_7601003001921_211111012316880071_20211116164659941.pdf          166155  Wed Nov 17 16:40:46 2021

When using sambal in irb.

irb(main):001:0> require 'sambal'
irb(main):002:0> smb = Sambal::Client.new(domain: 'ZZZ', host: 'prd-db-w01', share: 'FS_PRD', user: 'XXX', password: 'YYY')
irb(main):003:0> smb.cd '/some/strange/path'
irb(main):004:0> smb.ls
=> {"."=>{:type=>:directory, :size=>"0", :modified=>2021-11-03 10:22:12 +0100}, ".."=>{:type=>:directory, :size=>"0", :modified=>2021-11-03 10:21:57 +0100}}

And after toggling the archive flag, using file explorer.

smb: \some\strange\path\> ls
  .                                   D        0  Wed Nov  3 10:22:12 2021
  ..                                  D        0  Wed Nov  3 10:21:57 2021
  ID_84389_7601003001921_211111012316880071_20211116164659941.pdf      A   166155  Wed Nov 17 16:40:46 2021

The response from the sambal client.

irb(main):005:0> smb.ls
=> {"."=>{:type=>:directory, :size=>"0", :modified=>2021-11-03 10:22:12 +0100}, ".."=>{:type=>:directory, :size=>"0", :modified=>2021-11-03 10:21:57 +0100}, "ID_84389_7601003001921_211111012316880071_20211116164659941.pdf"=>{:type=>:file, :size=>"166155", :modified=>2021-11-17 16:40:46 +0100}}

The behaviour is likely caused by the + sign on https://github.com/johnae/sambal/blob/master/lib/sambal/client.rb#L291

If this is the expected behaviour, please feel free to slap me with a dead trout and close the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions