From 50fc6e1e9e8d286fd6a406cef75e48a28f9427ad Mon Sep 17 00:00:00 2001 From: George Goldberg Date: Fri, 25 Aug 2017 15:38:13 +0100 Subject: PLT-???? Prepare file upload infrastructure for Data Retention. (#7266) * Prepare file upload infrastructure for Data Retention. This commit prepares the file upload infrastructure for the data retention feature that is under construction. Changes are: * Move file management code to utils to allow access to it from jobs. * From now on, store all file uploads in a top level folder which is the date of the day on which they were uploaded. This commit is based on Harrison Healey's branch, but updated to work with the latest master. * Use NewAppError --- app/import.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'app/import.go') diff --git a/app/import.go b/app/import.go index fb7d43cdf..d404dbadd 100644 --- a/app/import.go +++ b/app/import.go @@ -12,9 +12,11 @@ import ( "regexp" "strings" "sync" + "time" "unicode/utf8" l4g "github.com/alecthomas/log4go" + "github.com/mattermost/platform/model" "github.com/mattermost/platform/store" "github.com/mattermost/platform/utils" @@ -1486,12 +1488,12 @@ func OldImportChannel(channel *model.Channel) *model.Channel { } } -func OldImportFile(file io.Reader, teamId string, channelId string, userId string, fileName string) (*model.FileInfo, error) { +func OldImportFile(timestamp time.Time, file io.Reader, teamId string, channelId string, userId string, fileName string) (*model.FileInfo, error) { buf := bytes.NewBuffer(nil) io.Copy(buf, file) data := buf.Bytes() - fileInfo, err := DoUploadFile(teamId, channelId, userId, fileName, data) + fileInfo, err := DoUploadFile(timestamp, teamId, channelId, userId, fileName, data) if err != nil { return nil, err } -- cgit v1.2.3-1-g7c22