focalboard/server/model/file.go
Scott Bishel 888c169910
Backport fixes for import/export attachments and fixes (#4741)
* Backport fixes for import/export attachments and fixes

* fix bad merge

* lint fixes

* Update server/app/boards.go

Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>

---------

Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>
2023-05-22 10:31:24 -06:00

26 lines
594 B
Go

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package model
import (
"mime"
"path/filepath"
"strings"
"github.com/mattermost/focalboard/server/utils"
mm_model "github.com/mattermost/mattermost-server/v6/model"
)
func NewFileInfo(name string) *mm_model.FileInfo {
extension := strings.ToLower(filepath.Ext(name))
now := utils.GetMillis()
return &mm_model.FileInfo{
CreatorId: "boards",
CreateAt: now,
UpdateAt: now,
Name: name,
Extension: extension,
MimeType: mime.TypeByExtension(extension),
}
}