diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2022-06-08 19:09:38 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2022-06-08 19:09:38 -0700 |
| commit | b196a50a44a5c72fc43df39fce4407d05ec8863b (patch) | |
| tree | 41419808e2c6ef5ef5a94b6e568b20653438a67e /hotline/transaction_handlers.go | |
| parent | 8168522a18e78acff2f6ca2f04b9f9300c6ee7a1 (diff) | |
Refactor filestore to simplify testing
Diffstat (limited to 'hotline/transaction_handlers.go')
| -rw-r--r-- | hotline/transaction_handlers.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/hotline/transaction_handlers.go b/hotline/transaction_handlers.go index f4c5a2f..1b69114 100644 --- a/hotline/transaction_handlers.go +++ b/hotline/transaction_handlers.go @@ -391,7 +391,7 @@ func HandleSetFileInfo(cc *ClientConn, t *Transaction) (res []Transaction, err e fileNewName := t.GetField(fieldFileNewName).Data if fileNewName != nil { - fi, err := FS.Stat(fullFilePath) + fi, err := cc.Server.FS.Stat(fullFilePath) if err != nil { return res, err } @@ -524,14 +524,14 @@ func HandleNewFolder(cc *ClientConn, t *Transaction) (res []Transaction, err err // TODO: check path and folder name lengths - if _, err := FS.Stat(newFolderPath); !os.IsNotExist(err) { + if _, err := cc.Server.FS.Stat(newFolderPath); !os.IsNotExist(err) { msg := fmt.Sprintf("Cannot create folder \"%s\" because there is already a file or folder with that name.", folderName) return []Transaction{cc.NewErrReply(t, msg)}, nil } // TODO: check for disallowed characters to maintain compatibility for original client - if err := FS.Mkdir(newFolderPath, 0777); err != nil { + if err := cc.Server.FS.Mkdir(newFolderPath, 0777); err != nil { msg := fmt.Sprintf("Cannot create folder \"%s\" because an error occurred.", folderName) return []Transaction{cc.NewErrReply(t, msg)}, nil } @@ -1523,7 +1523,7 @@ func HandleUploadFile(cc *ClientConn, t *Transaction) (res []Transaction, err er return res, err } - fileInfo, err := FS.Stat(fullFilePath + incompleteFileSuffix) + fileInfo, err := cc.Server.FS.Stat(fullFilePath + incompleteFileSuffix) if err != nil { return res, err } @@ -1856,7 +1856,7 @@ func HandleMakeAlias(cc *ClientConn, t *Transaction) (res []Transaction, err err cc.Server.Logger.Debugw("Make alias", "src", fullFilePath, "dst", fullNewFilePath) - if err := FS.Symlink(fullFilePath, fullNewFilePath); err != nil { + if err := cc.Server.FS.Symlink(fullFilePath, fullNewFilePath); err != nil { res = append(res, cc.NewErrReply(t, "Error creating alias")) return res, nil } |