diff --git a/core/space/services/services_fs.go b/core/space/services/services_fs.go index 271d0196..376863d4 100644 --- a/core/space/services/services_fs.go +++ b/core/space/services/services_fs.go @@ -358,7 +358,7 @@ func (s *Space) TruncateData(ctx context.Context) error { func (s *Space) openFileOnFs(ctx context.Context, path string, b textile.Bucket, isRemote bool, dbID, cid string) (string, error) { // write file copy to temp folder - tmpFile, err := s.createTempFileForPath(ctx, path, false) + tmpFile, err := s.createTempFileForPath(ctx, path, true) if err != nil { log.Error("cannot create temp file while executing OpenFile", err) return "", err diff --git a/core/space/space_test.go b/core/space/space_test.go index 81500186..3f8a3f2f 100644 --- a/core/space/space_test.go +++ b/core/space/space_test.go @@ -328,14 +328,6 @@ func TestService_OpenFile(t *testing.T) { testFileName := "file.txt" // setup mocks - cfg.On("GetInt", mock.Anything, mock.Anything).Return( - -1, - ) - - cfg.On("GetString", mock.Anything, mock.Anything).Return( - "", - ) - mockEnv.On("WorkingFolder").Return( getDir().dir, ) @@ -392,7 +384,7 @@ func TestService_OpenFile(t *testing.T) { assert.Nil(t, err) assert.NotEmpty(t, res) assert.FileExists(t, res.Location) - assert.Contains(t, res.Location, getDir().dir) + assert.Contains(t, res.Location, os.TempDir()) assert.True(t, strings.HasSuffix(res.Location, testFileName)) // assert mocks cfg.AssertExpectations(t)