Skip to content

[Bug]: prelogin hook doesn't work with virtualfolders #1890

Open
@firatkucuk

Description

@firatkucuk

⚠️ This issue respects the following points: ⚠️

  • This is a bug, not a question or a configuration issue.
  • This issue is not already reported on Github (I've searched it).

Bug description

Our pre login webhook returns a user definition every single time. sftpgo maps this user with an existing user in its database. That part works fine apart from VirtualFolder fs config. In the second login it falls back to LocalFileSystem.

After debugging, I found a mapping is missing on validation here

Current state:

virtualFolders = append(virtualFolders, vfs.VirtualFolder{
	BaseVirtualFolder: vfs.BaseVirtualFolder{
		Name:     v.Name,
	},```

Fix:

```go
virtualFolders = append(virtualFolders, vfs.VirtualFolder{
	BaseVirtualFolder: vfs.BaseVirtualFolder{
		Name:     v.Name,
		FsConfig: v.FsConfig,
	},

Alternative solution user id should be persisted on webhook side and after every login the same userid should be sent.

Steps to reproduce

  1. Adjust a prelogin hook with virtul folder definitions apart from local.
  2. Connect
  3. Disconnect
  4. Connect again
  5. Virtual folder won't work because of missing FsConfig

Expected behavior

Virtual folders mapping should work.

SFTPGo version

2.6.5

Data provider

S3

Installation method

Community Docker image

Configuration

standard configuration

Relevant log output

What are you using SFTPGo for?

Medium business

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions