diff --git a/handlers/grid.go b/handlers/grid.go index 8545775..9eeb2da 100644 --- a/handlers/grid.go +++ b/handlers/grid.go @@ -141,10 +141,6 @@ func Grid() fiber.Handler { return err } - if len(item.Medias) == 1 { - return c.Redirect("/images/" + postID + "/1") - } - // Filter media only include image var mediaURLs []string for _, media := range item.Medias { @@ -154,6 +150,10 @@ func Grid() fiber.Handler { mediaURLs = append(mediaURLs, media.URL) } + if len(item.Medias) == 1 || len(mediaURLs) == 1 { + return c.Redirect("/images/" + postID + "/1") + } + var wg sync.WaitGroup images := make([]image.Image, len(mediaURLs)) client := http.Client{Transport: transport, Timeout: timeout}