update import/export for attachments and new file paths (#22915)
* update import/export for attachments and new file paths * add unit test * update templates test * temp checking * cleanup * cleanup * more cleanup * lint fixes * cleanup some functions * cleanup * fix build breaks * fix tests for changes * move function to different file * more cleanup, code movement * unit test fixes * add unit tests * fix tests * more unit test fixes * test fix * revert package-lock.json * fixes from code review * fix export image * more fixes to remove attachmentId * change from removed api * update test * lint fixes * update for review comments * fix tests * test fix * lint fix * remove sprintf from logging, use mlog * more lint fixes * Update server/boards/app/files.go Co-authored-by: Doug Lauder <wiggin77@warpmail.net> * remove code --------- Co-authored-by: Mattermost Build <build@mattermost.com> Co-authored-by: Doug Lauder <wiggin77@warpmail.net>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
ac35bdff68
Коммит
81ef403230
27
server/boards/model/file.go
Обычный файл
27
server/boards/model/file.go
Обычный файл
@@ -0,0 +1,27 @@
|
||||
// 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/mattermost-server/server/v8/boards/utils"
|
||||
mm_model "github.com/mattermost/mattermost-server/server/v8/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),
|
||||
}
|
||||
|
||||
}
|
||||
Ссылка в новой задаче
Block a user