]> git.r.bdr.sh - rbdr/mobius/commitdiff
Fix some Windows compatibility issues
authorJeff Halter <redacted>
Tue, 21 Jun 2022 16:18:56 +0000 (09:18 -0700)
committerJeff Halter <redacted>
Tue, 21 Jun 2022 16:18:56 +0000 (09:18 -0700)
hotline/file_path.go
hotline/server.go
hotline/transaction_handlers.go

index c8fe652e878aa559e67bae2e9d3d59a1f89a4d35..c7e1574f39b7f89b6f20612063b86795682f9143 100644 (file)
@@ -94,7 +94,6 @@ func readPath(fileRoot string, filePath, fileName []byte) (fullPath string, err
        }
 
        fullPath = filepath.Join(
-               "/",
                fileRoot,
                fp.String(),
                filepath.Join("/", string(fileName)),
index 9ffd27257340d41554b6d67ab22088f9650553b7..ba0a6689c619251620e28a4dab4c195ea024fb04 100644 (file)
@@ -808,8 +808,6 @@ func (s *Server) handleFileTransfer(ctx context.Context, rwc io.ReadWriter) erro
                        return err
                }
 
-               defer func() { _ = file.Close() }()
-
                s.Logger.Infow("File upload started", "transactionRef", fileTransfer.ReferenceNumber, "dstFile", destinationFile)
 
                rForkWriter := io.Discard
@@ -830,6 +828,10 @@ func (s *Server) handleFileTransfer(ctx context.Context, rwc io.ReadWriter) erro
                        return err
                }
 
+               if err := file.Close(); err != nil {
+                       return err
+               }
+               
                if err := s.FS.Rename(destinationFile+".incomplete", destinationFile); err != nil {
                        return err
                }
index c3b8c592bf2f5d8ea55a533ce5c6251544d9175e..f080047563bda847aebba3855be3b24266d9cefc 100644 (file)
@@ -5,6 +5,7 @@ import (
        "encoding/binary"
        "errors"
        "fmt"
+       "github.com/davecgh/go-spew/spew"
        "gopkg.in/yaml.v3"
        "io/ioutil"
        "math/big"
@@ -1658,6 +1659,8 @@ func HandleGetFileNameList(cc *ClientConn, t *Transaction) (res []Transaction, e
                return res, err
        }
 
+       spew.Dump(fullPath)
+
        var fp FilePath
        if t.GetField(fieldFilePath).Data != nil {
                if err = fp.UnmarshalBinary(t.GetField(fieldFilePath).Data); err != nil {