mickael-kerjean / filestash

🦄 A file manager / web client for SFTP, S3, FTP, WebDAV, Git, Minio, LDAP, CalDAV, CardDAV, Mysql, Backblaze, ...
https://www.filestash.app/
GNU Affero General Public License v3.0
10.1k stars 738 forks source link

[bug] SMB host variable BUG #693

Open matoH12 opened 5 months ago

matoH12 commented 5 months ago

Description of the bug

The authetification in SMB plugin no work. The host variable is not apply

Step by step instructions to reproduce the bug

Create SAMBA backend and try login. In debug log you can not see the host variale correcty. Im see in host error

Im find in code this:

if u, err := url.Parse(params["host"]); err == nil {
        **params["host"] = u.Host**
        if params["port"] == "" {
            params["port"] = u.Port()
        }
        if params["share"] == "" {
            params["share"] = strings.ReplaceAll(u.Path, "/", "")
        }

where the "u.Host" dont have (). u.Host()

serboupal commented 4 months ago

u.Host is a string so no need for parentheses there. The function url.Parse expect a string with protocol. If you want to use samba, you need to specify smb://hostname as hostname. I thing this should be changed so it add automatically the protocol if is missing

zeighy commented 3 months ago

Looks like this got fixed recently... https://github.com/mickael-kerjean/filestash/commit/d898231918727a4d2e4de3f0ff2b0737915b577a

Ownercz commented 3 months ago

Thanks for the workaround and dev for the fix. I just encountered this issue using latest docker image 14f176ae7f6e. With full protocol specification in url it works allright.

mwllgr commented 3 months ago

Also encountered this problem - as a workaround, I added smb:// to the hostname prefix as mentioned by @serboupal - thanks! :)