Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel API /api/file/readDir support for returning symbolic link information #8805

Merged
merged 2 commits into from
Jul 22, 2023

Conversation

Zuoqiu-Yingyi
Copy link
Contributor

@Zuoqiu-Yingyi Zuoqiu-Yingyi commented Jul 22, 2023

  • Please commit to the dev branch
  • For contributing new features, please supplement and improve the corresponding user guide documents
  • directory symlink: isDir: true, isSymlink: true
  • directory normal: isDir: true, isSymlink: false
  • file symlink: isDir: false, isSymlink: true
  • file normal: isDir: false, isSymlink: false

@github-actions github-actions bot changed the base branch from master to dev July 22, 2023 02:17
@github-actions
Copy link

Your PR was set to target master, PRs should be target dev
The base branch of this PR has been automatically changed to dev, please check that there are no merge conflicts

"name": entry.Name(),
"isDir": entry.IsDir(),
"name": entry.Name(),
"isDir": info.IsDir(),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"isDir": info.IsDir(),
"isDir": entry.IsDir(),

Why change from entry.IsDir() to info.IsDir() ?
entry.IsDir() / dir.IsDir() (where entry and dir are of type fs.DirEntry) is being used in kernel/util/file.go > IsDirRegularOrSymlink too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// entry is a symlink to a dir
path := filepath.Join(dirPath, entry.Name())
info, err = os.Stat(path)

entry.IsDir() // return false
info.IsDir() // return true

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guys, let's make sure the code here is ok:

image

Copy link
Member

@88250 88250 Jul 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry, I missed the changes in file.go later, Zuoqiu has extracted a function IsSymlink(), it seems to be no problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guys, let's make sure the code here is ok:

image

If this function's name is IsDirRegularOrSymlink, it's Ok.
If this function's name is IsDirRegularOrDirSymlink, it's not Ok.👀

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Zuoqiu-Yingyi Thanks for the explanation, I get it, merge first.

@fenilgmehta If there is something we missed, please continue to add comments, thank you.

@88250 88250 added this to the 2.9.7 milestone Jul 22, 2023
@88250 88250 merged commit b45cf73 into siyuan-note:dev Jul 22, 2023
2 checks passed
@Zuoqiu-Yingyi Zuoqiu-Yingyi deleted the feat/api-readDir branch July 22, 2023 14:20
@88250 88250 changed the title API /api/file/readDir support for returning symbolic link information Kernel API /api/file/readDir support for returning symbolic link information Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants