mirror of
https://github.com/rystaf/mlmym.git
synced 2024-11-21 21:27:15 +00:00
handle expandos for images with query parameters
This commit is contained in:
parent
de281c00ee
commit
e0d7290e51
|
@ -548,9 +548,6 @@ form.blockpost {
|
|||
.expando.open{
|
||||
display: block;
|
||||
}
|
||||
.expando .embed {
|
||||
text-align: center;
|
||||
}
|
||||
.expando .image {
|
||||
max-width: 578px;
|
||||
}
|
||||
|
|
11
routes.go
11
routes.go
|
@ -12,6 +12,7 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -111,9 +112,13 @@ var funcMap = template.FuncMap{
|
|||
}
|
||||
return ""
|
||||
},
|
||||
"isImage": func(url string) bool {
|
||||
ext := url[len(url)-4:]
|
||||
if ext == "jpeg" || ext == ".jpg" || ext == ".png" || ext == "webp" || ext == ".gif" {
|
||||
"isImage": func(u string) bool {
|
||||
p, err := url.Parse(u)
|
||||
if err != nil || p.Path == "" {
|
||||
return false
|
||||
}
|
||||
ext := filepath.Ext(p.Path)
|
||||
if ext == ".jpeg" || ext == ".jpg" || ext == ".png" || ext == ".webp" || ext == ".gif" {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
|
Loading…
Reference in a new issue