Skip to content

Commit

Permalink
Fixed bug on windows with : in path
Browse files Browse the repository at this point in the history
  • Loading branch information
coltoneshaw committed Jan 17, 2024
1 parent 50cf2b5 commit ea0b527
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion commands/grid_transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func gridTransformCmdF(cmd *cobra.Command, args []string) error {

err = slackTransformer.ExtractDirectory(zipReader)
if err != nil {
logger.Error("error extracting zip file", err)
logger.Error("error extracting zip file. error:", err)
return nil
}

Expand Down
7 changes: 6 additions & 1 deletion services/slack_grid/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io/fs"
"os"
"path/filepath"
"strings"

"github.com/pkg/errors"
)
Expand Down Expand Up @@ -72,7 +73,11 @@ func (t *BulkTransformer) ExtractDirectory(zipReader *zip.Reader) error {
totalFiles := len(zipReader.File)

for i, f := range zipReader.File {
fpath := filepath.Join(t.dirPath, f.Name)

// slack file conversations have a : in the name. So, "FC:123:123" would be valid. This simply removes the : from the name.
// currently, these imports are not supported by the slack grid importer so the files are not referenced later.
sanitizedFileName := strings.ReplaceAll(f.Name, ":", "")
fpath := filepath.Join(t.dirPath, sanitizedFileName)

if f.FileInfo().IsDir() {
// Make Folder
Expand Down

0 comments on commit ea0b527

Please sign in to comment.