Only add image files to imageBox files slice (#2017)

* Only add image files to `imageBox` files slice
* Update Changelog
This commit is contained in:
peolic 2021-11-17 02:58:49 +02:00 committed by GitHub
parent 89c7c022f6
commit 955083882e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 4 deletions

View file

@ -17,14 +17,31 @@ type imageBox struct {
files []string
}
var imageExtensions = []string{
".jpg",
".jpeg",
".png",
".gif",
".svg",
".webp",
}
func newImageBox(box fs.FS) (*imageBox, error) {
ret := &imageBox{
box: box,
}
err := fs.WalkDir(box, ".", func(path string, d fs.DirEntry, err error) error {
if !d.IsDir() {
ret.files = append(ret.files, path)
if d.IsDir() {
return nil
}
baseName := strings.ToLower(d.Name())
for _, ext := range imageExtensions {
if strings.HasSuffix(baseName, ext) {
ret.files = append(ret.files, path)
break
}
}
return nil

View file

@ -14,6 +14,7 @@ import V080 from "./versions/v080.md";
import V090 from "./versions/v090.md";
import V0100 from "./versions/v0100.md";
import V0110 from "./versions/v0110.md";
import V0120 from "./versions/v0120.md";
import { MarkdownPage } from "../Shared/MarkdownPage";
// to avoid use of explicit any
@ -52,9 +53,9 @@ const Changelog: React.FC = () => {
// after new release:
// add entry to releases, using the current* fields
// then update the current fields.
const currentVersion = stashVersion || "v0.11.0";
const currentVersion = stashVersion || "v0.12.0";
const currentDate = buildDate;
const currentPage = V0110;
const currentPage = V0120;
const releases: IStashRelease[] = [
{
@ -63,6 +64,11 @@ const Changelog: React.FC = () => {
page: currentPage,
defaultOpen: true,
},
{
version: "v0.11.0",
date: "2021-11-15",
page: V0110,
},
{
version: "v0.10.0",
date: "2021-10-11",

View file

@ -0,0 +1,2 @@
### 🐛 Bug fixes
* Fix "Custom Performer Images" feature picking up non-image files. ([#2017](https://github.com/stashapp/stash/pull/2017))