From f4106e156f829f69a6bb13a3a250ffeb97ff33a3 Mon Sep 17 00:00:00 2001 From: Nabil Ould Hamou Date: Sat, 2 Mar 2024 00:04:00 +0100 Subject: [PATCH] fix: bug --- initializers/assets.go | 10 ++-------- main.go | 4 ++-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/initializers/assets.go b/initializers/assets.go index d5ef060..a4ff015 100644 --- a/initializers/assets.go +++ b/initializers/assets.go @@ -10,14 +10,8 @@ var ReleaseBasePath string = "/data/assets/" func CreateAssetsFolder(basePath string) { - if _, err := os.Stat(basePath + "images"); os.IsNotExist(err) { - if err := os.MkdirAll(basePath+"images", os.ModePerm); err != nil { - log.Fatal(err) - } - } - - if _, err := os.Stat(basePath + "videos"); os.IsNotExist(err) { - if err := os.MkdirAll(basePath+"videos", os.ModePerm); err != nil { + if _, err := os.Stat(basePath); os.IsNotExist(err) { + if err := os.MkdirAll(basePath, os.ModePerm); err != nil { log.Fatal(err) } } diff --git a/main.go b/main.go index 41b08c2..2586c8a 100644 --- a/main.go +++ b/main.go @@ -39,9 +39,9 @@ func main() { // Files if currentMode == "debug" { - api.Router.Static("assets", initializers.DebugBasePath+"/images") + api.Router.Static("assets", initializers.DebugBasePath) } else { - api.Router.Static("assets", initializers.ReleaseBasePath+"/images") + api.Router.Static("assets", initializers.ReleaseBasePath) } // Posts