filtre folder media
This commit is contained in:
parent
44cf222bf5
commit
3fc81e5c80
@ -82,7 +82,12 @@ func Login(w http.ResponseWriter, r *http.Request){
|
|||||||
func Dashboard(db *gorm.DB)http.HandlerFunc {
|
func Dashboard(db *gorm.DB)http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var paths []models.PathDownload
|
var paths []models.PathDownload
|
||||||
if err := db.Find(&paths).Error; err != nil {
|
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)
|
http.Error(w, `{"error": "Failed to retrieve paths"}`, http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user