Skip to content

feat: add smb driver (close #1746) - #2114

Merged
xhofe merged 2 commits into
AlistGo:mainfrom
BoYanZh:main
Oct 25, 2022
Merged

feat: add smb driver (close #1746)#2114
xhofe merged 2 commits into
AlistGo:mainfrom
BoYanZh:main

Conversation

@BoYanZh

@BoYanZh BoYanZh commented Oct 25, 2022

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread drivers/smb/driver.go Outdated

func (d *SMB) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error) {
fullPath := file.GetPath()
return &model.Link{FilePath: &fullPath}, nil

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is it correct to return the local file path here?

@BoYanZh BoYanZh Oct 25, 2022

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, I have tried to return the path with the prefix . and it gives a 500 error when directly browsing a file, which takes me some time to find out.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

But wouldn't that just return the native file only?

it is possible that smb on another machine.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sorry. I think I understand now.
SMB is mounted locally, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My bad, I think I do not understand the meaning of the function, trying to fix it now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think it works now for smb on another machine.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ok. This is function return one of three:

  • path of native file
  • download url of web file
  • reader closer

For this, It maybe like:

f,_ := d.fs.Open(converted_path)
return &Link{
    Data: f
}

In a rough sense

@xhofe

xhofe commented Oct 25, 2022

Copy link
Copy Markdown
Collaborator

Looks super - thank you. I wounld merge it after ci finished.

@xhofe
xhofe merged commit dd4674e into AlistGo:main Oct 25, 2022
@peeweep

peeweep commented Oct 25, 2022

Copy link
Copy Markdown

非常感谢,我最近出于一些原因,把文件共享服务器从原来的 caddy webdav module 换成了 samba,这个 PR 正是我需要的。

@SheltonZhu

Copy link
Copy Markdown

今天试了下,好用!正好有这个需求。
就是今天rootpath配置错了的时候,把主程序弄奔溃了

asogii pushed a commit to asogii/openlist that referenced this pull request Apr 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants