summaryrefslogtreecommitdiffstats
path: root/api4/file.go
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2017-08-25 15:38:13 +0100
committerHarrison Healey <harrisonmhealey@gmail.com>2017-08-25 10:38:13 -0400
commit50fc6e1e9e8d286fd6a406cef75e48a28f9427ad (patch)
tree0689de640729194b9a123ec8bfef36cbecd8cefd /api4/file.go
parent99acf6106833a2186c0f7e07985feac5d9c25de1 (diff)
downloadchat-50fc6e1e9e8d286fd6a406cef75e48a28f9427ad.tar.gz
chat-50fc6e1e9e8d286fd6a406cef75e48a28f9427ad.tar.bz2
chat-50fc6e1e9e8d286fd6a406cef75e48a28f9427ad.zip
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
Diffstat (limited to 'api4/file.go')
-rw-r--r--api4/file.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/api4/file.go b/api4/file.go
index 0607c1942..7dc13dafc 100644
--- a/api4/file.go
+++ b/api4/file.go
@@ -123,7 +123,7 @@ func getFile(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- data, err := app.ReadFile(info.Path)
+ data, err := utils.ReadFile(info.Path)
if err != nil {
c.Err = err
c.Err.StatusCode = http.StatusNotFound
@@ -165,7 +165,7 @@ func getFileThumbnail(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- if data, err := app.ReadFile(info.ThumbnailPath); err != nil {
+ if data, err := utils.ReadFile(info.ThumbnailPath); err != nil {
c.Err = err
c.Err.StatusCode = http.StatusNotFound
} else if err := writeFileResponse(info.Name, THUMBNAIL_IMAGE_TYPE, data, forceDownload, w, r); err != nil {
@@ -237,7 +237,7 @@ func getFilePreview(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- if data, err := app.ReadFile(info.PreviewPath); err != nil {
+ if data, err := utils.ReadFile(info.PreviewPath); err != nil {
c.Err = err
c.Err.StatusCode = http.StatusNotFound
} else if err := writeFileResponse(info.Name, PREVIEW_IMAGE_TYPE, data, forceDownload, w, r); err != nil {
@@ -299,7 +299,7 @@ func getPublicFile(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- if data, err := app.ReadFile(info.Path); err != nil {
+ if data, err := utils.ReadFile(info.Path); err != nil {
c.Err = err
c.Err.StatusCode = http.StatusNotFound
} else if err := writeFileResponse(info.Name, info.MimeType, data, true, w, r); err != nil {