MM-11272 Add OpenGraph and image dimension metadata to posts (#9313)

* Move OpenGraph code into its own file

* Move OpenGraph image proxying to app layer

* Move test file code out of api4 package

* MM-11272 Add OpenGraph and image dimension metadata to posts
Этот коммит содержится в:
Harrison Healey
2018-09-04 08:33:29 -04:00
родитель 48f16b6401
Коммит 2959b53d98
16 изменённых файлов: 819 добавлений и 285 удалений

29
utils/testutils/testutils.go Обычный файл
Просмотреть файл

@@ -0,0 +1,29 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package testutils
import (
"bytes"
"io"
"os"
"path/filepath"
"github.com/mattermost/mattermost-server/utils"
)
func ReadTestFile(name string) ([]byte, error) {
path, _ := utils.FindDir("tests")
file, err := os.Open(filepath.Join(path, name))
if err != nil {
return nil, err
}
defer file.Close()
data := &bytes.Buffer{}
if _, err := io.Copy(data, file); err != nil {
return nil, err
} else {
return data.Bytes(), nil
}
}