diff --git a/core/space/services/services_fs.go b/core/space/services/services_fs.go index fc6b0b7c..ad8d0d23 100644 --- a/core/space/services/services_fs.go +++ b/core/space/services/services_fs.go @@ -178,7 +178,7 @@ func (s *Space) listDirAtPath( entries := make([]domain.FileInfo, 0) for _, item := range dir.Item.Items { - if item.Name == ".textileseed" || item.Name == ".textile" { + if utils.IsMetaFileName(item.Name) { continue } diff --git a/core/textile/secure_bucket_client.go b/core/textile/secure_bucket_client.go index e42b7ce7..d95e57fb 100644 --- a/core/textile/secure_bucket_client.go +++ b/core/textile/secure_bucket_client.go @@ -9,6 +9,7 @@ import ( "strings" "github.com/FleekHQ/space-daemon/core/textile/common" + "github.com/FleekHQ/space-daemon/core/textile/utils" "github.com/FleekHQ/space-daemon/log" @@ -132,7 +133,7 @@ func (s *SecureBucketClient) overwriteDecryptedItem(ctx context.Context, item *b if err != nil { return err } - if item.Name == ".textileseed" || item.Name == ".textile" { + if utils.IsMetaFileName(item.Name) { return nil } // decrypt file name diff --git a/core/textile/sync/pinning.go b/core/textile/sync/pinning.go index 1bb5b660..48879a6d 100644 --- a/core/textile/sync/pinning.go +++ b/core/textile/sync/pinning.go @@ -5,6 +5,7 @@ import ( "io" "strings" + "github.com/FleekHQ/space-daemon/core/textile/utils" "github.com/FleekHQ/space-daemon/log" ) @@ -67,7 +68,7 @@ func (s *synchronizer) uploadAllFilesInPath(ctx context.Context, bucket, path st } for _, item := range dir.Item.Items { - if item.Name == ".textileseed" || item.Name == ".textile" { + if utils.IsMetaFileName(item.Name) { continue } @@ -116,7 +117,7 @@ func (s *synchronizer) deleteAllFilesInPath(ctx context.Context, bucket, path st } for _, item := range dir.Item.Items { - if item.Name == ".textileseed" || item.Name == ".textile" { + if utils.IsMetaFileName(item.Name) { continue } diff --git a/core/textile/utils/utils.go b/core/textile/utils/utils.go index dba5242a..4de7a32a 100644 --- a/core/textile/utils/utils.go +++ b/core/textile/utils/utils.go @@ -7,6 +7,7 @@ import ( "encoding/base32" "encoding/binary" "encoding/hex" + "path/filepath" "github.com/FleekHQ/space-daemon/core/keychain" "github.com/FleekHQ/space-daemon/core/textile/hub" @@ -126,3 +127,13 @@ func RandBytes(size int) ([]byte, error) { _, err := rand.Read(b) return b, err } + +func IsMetaFileName(pathOrName string) bool { + _, name := filepath.Split(pathOrName) + + if name == ".textileseed" || name == ".textile" { + return true + } + + return false +}