Skip to content

Commit 1b231e0

Browse files
Added logic to resolve local path
1 parent 820e348 commit 1b231e0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

internal/transprocessor/utils.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
package transprocessor
22

33
import (
4+
"path"
45
"strings"
56

67
"github.com/PythonHacker24/linux-acl-management-backend/config"
78
)
89

9-
func FindServerFromPath(servers []config.FileSystemServers, filepath string) (isRemote bool, host string, port int, found bool, absolutePath string) {
10+
func FindServerFromPath(filepath string) (isRemote bool, host string, port int, found bool, absolutePath string) {
1011
/* search through all the servers */
11-
for _, server := range servers {
12+
for _, server := range config.BackendConfig.FileSystemServers {
1213
/* check if the server path has the prefix for filepath */
1314
if strings.HasPrefix(filepath, server.Path) {
1415
absolutePath := strings.TrimPrefix(filepath, server.Path)
@@ -17,7 +18,7 @@ func FindServerFromPath(servers []config.FileSystemServers, filepath string) (is
1718
return true, server.Remote.Host, server.Remote.Port, true, absolutePath
1819
}
1920
/* local filesystem */
20-
return false, "", 0, true, absolutePath
21+
return false, "", 0, true, path.Join(config.BackendConfig.AppInfo.BasePath, filepath)
2122
}
2223
}
2324

0 commit comments

Comments
 (0)