diff options
Diffstat (limited to 'api')
-rw-r--r-- | api/file.go | 1 | ||||
-rw-r--r-- | api/slackimport.go | 11 |
2 files changed, 11 insertions, 1 deletions
diff --git a/api/file.go b/api/file.go index 1d8244fac..692558acf 100644 --- a/api/file.go +++ b/api/file.go @@ -349,6 +349,7 @@ func getFile(c *Context, w http.ResponseWriter, r *http.Request) { w.Header().Set("Cache-Control", "max-age=2592000, public") w.Header().Set("Content-Length", strconv.Itoa(len(f))) + w.Header().Set("Content-Type", "") // need to provide proper Content-Type in the future w.Write(f) } diff --git a/api/slackimport.go b/api/slackimport.go index 1d037a934..4e6c01dbb 100644 --- a/api/slackimport.go +++ b/api/slackimport.go @@ -50,6 +50,15 @@ func SlackConvertTimeStamp(ts string) int64 { return timeStamp * 1000 // Convert to milliseconds } +func SlackConvertChannelName(channelName string) string { + newName := strings.Trim(channelName, "_-") + if len(newName) == 1 { + return "slack-channel-" + newName + } + + return newName +} + func SlackParseChannels(data io.Reader) []SlackChannel { decoder := json.NewDecoder(data) @@ -172,7 +181,7 @@ func SlackAddChannels(teamId string, slackchannels []SlackChannel, posts map[str TeamId: teamId, Type: model.CHANNEL_OPEN, DisplayName: sChannel.Name, - Name: sChannel.Name, + Name: SlackConvertChannelName(sChannel.Name), Description: sChannel.Topic["value"], } mChannel := ImportChannel(&newChannel) |