From 43bdbb0c3a0d93a8bf34ae5e2abbad4586a2581b Mon Sep 17 00:00:00 2001 From: Julien Levesy Date: Mon, 15 Oct 2018 16:46:26 +0200 Subject: Add a delete brand image action on the APIv4 (#9552) --- app/brand.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'app') diff --git a/app/brand.go b/app/brand.go index a2feac7ec..6c1091fff 100644 --- a/app/brand.go +++ b/app/brand.go @@ -77,3 +77,19 @@ func (a *App) GetBrandImage() ([]byte, *model.AppError) { return img, nil } + +func (a *App) DeleteBrandImage() *model.AppError { + filePath := BRAND_FILE_PATH + BRAND_FILE_NAME + + fileExists, err := a.FileExists(filePath) + + if err != nil { + return err + } + + if !fileExists { + return model.NewAppError("DeleteBrandImage", "api.admin.delete_brand_image.storage.not_found", nil, "", http.StatusNotFound) + } + + return a.RemoveFile(filePath) +} -- cgit v1.2.3-1-g7c22