sshnet / sshnet/SSH.NET

Current Directory and Parent Directory returned by ListDirectory.

Open
#331 0 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
4.4k
Forks
993
Avg merge
9d 21h
Merged PRs (30d)
1

Description

Running sftpClient.ListDirectory(path) returns values . and ...
Whilst this is valid behaviour, special consideration has to be given whenever using this command to determine if we want these "relative-folders". There's also no flag (e.g. IsRelative) to easily filter; rather we have to filter on the folder's name to detect / exclude these.

$client.ListDirectory('/files') | Format-Table Name, Is* -AutoSize
Name                      IsSocket IsSymbolicLink IsRegularFile IsBlockDevice IsDirectory IsCharacterDevice IsNamedPipe
----                      -------- -------------- ------------- ------------- ----------- ----------------- -----------
..                           False          False         False         False        True             False       False
out                          False          False         False         False        True             False       False
.                            False          False         False         False        True             False       False
in                           False          False         False         False        True             False       False

Adding an option to hide these (either on the call to ListDirectory, or as a preference for the SftpClient itself would be helpful; or simply providing an IsRelative property on the SftpFile class to allow easy discrimination.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the ListDirectory entry point and inspect the SftpFile representation shown by the issue. Compare the requested filtering option with an IsRelative-style discriminator, then verify that the chosen behavior lets callers exclude . and .. without name-based filtering. Done means the API exposes a documented, testable way to hide or identify both entries.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.