Fixing issues with files trasitioning to relative paths
Этот коммит содержится в:
33
api/post.go
33
api/post.go
@@ -160,39 +160,6 @@ func CreatePost(c *Context, post *model.Post, doUpdateLastViewed bool) (*model.P
|
||||
|
||||
post.UserId = c.Session.UserId
|
||||
|
||||
if len(post.Filenames) > 0 {
|
||||
doRemove := false
|
||||
for i := len(post.Filenames) - 1; i >= 0; i-- {
|
||||
path := post.Filenames[i]
|
||||
|
||||
doRemove = false
|
||||
if model.UrlRegex.MatchString(path) {
|
||||
continue
|
||||
} else if model.PartialUrlRegex.MatchString(path) {
|
||||
matches := model.PartialUrlRegex.FindAllStringSubmatch(path, -1)
|
||||
if len(matches) == 0 || len(matches[0]) < 5 {
|
||||
doRemove = true
|
||||
}
|
||||
|
||||
channelId := matches[0][2]
|
||||
if channelId != post.ChannelId {
|
||||
doRemove = true
|
||||
}
|
||||
|
||||
userId := matches[0][3]
|
||||
if userId != post.UserId {
|
||||
doRemove = true
|
||||
}
|
||||
} else {
|
||||
doRemove = true
|
||||
}
|
||||
if doRemove {
|
||||
l4g.Error("Bad filename discarded, filename=%v", path)
|
||||
post.Filenames = append(post.Filenames[:i], post.Filenames[i+1:]...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var rpost *model.Post
|
||||
if result := <-Srv.Store.Post().Save(post); result.Err != nil {
|
||||
return nil, result.Err
|
||||
|
||||
Ссылка в новой задаче
Block a user