aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/mobius/handlers_files.go4
-rw-r--r--internal/mobius/handlers_files_test.go2
-rw-r--r--internal/mobius/handlers_transfers.go4
-rw-r--r--internal/mobius/handlers_transfers_test.go1
4 files changed, 6 insertions, 5 deletions
diff --git a/internal/mobius/handlers_files.go b/internal/mobius/handlers_files.go
index 4052206..cbdf61e 100644
--- a/internal/mobius/handlers_files.go
+++ b/internal/mobius/handlers_files.go
@@ -144,7 +144,7 @@ func HandleSetFileInfo(cc *hotline.ClientConn, t *hotline.Transaction) (res []ho
if !cc.Authorize(hotline.AccessRenameFolder) {
return cc.NewErrReply(t, ErrMsgNotAllowedRenameFolders)
}
- err = os.Rename(fullFilePath, fullNewFilePath)
+ err = cc.Server.FS.Rename(fullFilePath, fullNewFilePath)
if os.IsNotExist(err) {
return cc.NewErrReply(t, fmt.Sprintf(ErrMsgCannotRenameFolderNotFound, string(fileName)))
}
@@ -382,7 +382,7 @@ func HandleGetFileNameList(cc *hotline.ClientConn, t *hotline.Transaction) (res
return cc.NewErrReply(t, ErrMsgNotAllowedViewDropBoxes)
}
- fileNames, err := hotline.GetFileNameList(fullPath, cc.Server.Config.IgnoreFiles, cc.TextEncoder(), cc.Logger)
+ fileNames, err := hotline.GetFileNameList(cc.Server.FS, fullPath, cc.Server.Config.IgnoreFiles, cc.TextEncoder(), cc.Logger)
if err != nil {
cc.Logger.Error("error getting file name list", "err", err)
return cc.NewErrReply(t, "Cannot get file list.")
diff --git a/internal/mobius/handlers_files_test.go b/internal/mobius/handlers_files_test.go
index a2073a9..fd022bb 100644
--- a/internal/mobius/handlers_files_test.go
+++ b/internal/mobius/handlers_files_test.go
@@ -748,7 +748,7 @@ func TestHandleGetFileNameList(t *testing.T) {
return filepath.Join(path, "/test/config/Files/getFileNameListTestDir")
}(),
},
- Server: &hotline.Server{TextDecoder: charmap.Macintosh.NewDecoder(), TextEncoder: charmap.Macintosh.NewEncoder()},
+ Server: &hotline.Server{FS: &hotline.OSFileStore{}, TextDecoder: charmap.Macintosh.NewDecoder(), TextEncoder: charmap.Macintosh.NewEncoder()},
},
t: hotline.NewTransaction(
hotline.TranGetFileNameList, [2]byte{0, 1},
diff --git a/internal/mobius/handlers_transfers.go b/internal/mobius/handlers_transfers.go
index 315135e..c5eab8c 100644
--- a/internal/mobius/handlers_transfers.go
+++ b/internal/mobius/handlers_transfers.go
@@ -117,12 +117,12 @@ func HandleDownloadFolder(cc *hotline.ClientConn, t *hotline.Transaction) (res [
return cc.NewErrReply(t, ErrMsgFileNotFound)
}
- transferSize, err := hotline.CalcTotalSize(fullFilePath)
+ transferSize, err := hotline.CalcTotalSize(cc.Server.FS, fullFilePath)
if err != nil {
cc.Logger.Error("download folder: calc total size", "err", err)
return cc.NewErrReply(t, ErrMsgDownloadFolder)
}
- itemCount, err := hotline.CalcItemCount(fullFilePath)
+ itemCount, err := hotline.CalcItemCount(cc.Server.FS, fullFilePath)
if err != nil {
cc.Logger.Error("download folder: calc item count", "err", err)
return cc.NewErrReply(t, ErrMsgDownloadFolder)
diff --git a/internal/mobius/handlers_transfers_test.go b/internal/mobius/handlers_transfers_test.go
index 28c2768..4e4ba0f 100644
--- a/internal/mobius/handlers_transfers_test.go
+++ b/internal/mobius/handlers_transfers_test.go
@@ -535,6 +535,7 @@ func TestHandleDownloadFolder_withAccess(t *testing.T) {
}(),
},
Server: &hotline.Server{
+ FS: &hotline.OSFileStore{},
TextDecoder: charmap.Macintosh.NewDecoder(),
TextEncoder: charmap.Macintosh.NewEncoder(),
FileTransferMgr: hotline.NewMemFileTransferMgr(),