diff --git a/renders/renders.go b/renders/renders.go index 0180f49..cf2b83d 100644 --- a/renders/renders.go +++ b/renders/renders.go @@ -82,10 +82,15 @@ func Login(w http.ResponseWriter, r *http.Request){ func Dashboard(db *gorm.DB)http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var paths []models.PathDownload - if err := db.Find(&paths).Error; err != nil { - http.Error(w, `{"error": "Failed to retrieve paths"}`, http.StatusInternalServerError) - return - } + root := "/app/upload" + + // on sélectionne tout ce qui est sous /app/upload/, mais pas plus loin qu’un seul slash en plus + if err := db. + Where("path LIKE ? AND path NOT LIKE ?", root+"/%", root+"/%/%"). + Find(&paths).Error; err != nil { + http.Error(w, `{"error": "Failed to retrieve paths"}`, http.StatusInternalServerError) + return + } data := map[string]interface{}{ "paths": paths, }