From 4d800a14f4595cbd137a013711c1475ebfdbf314 Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Fri, 11 Mar 2022 09:35:48 +1100 Subject: [PATCH 1/3] Use case-insensitive matching in nameMatchesPath (#2378) Also ensures that only unique words are returned in getPathWords. --- pkg/match/path.go | 11 +++-------- pkg/match/path_test.go | 6 ++++++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pkg/match/path.go b/pkg/match/path.go index 5ae799de9..18cf18bf0 100644 --- a/pkg/match/path.go +++ b/pkg/match/path.go @@ -11,6 +11,7 @@ import ( "github.com/stashapp/stash/pkg/image" "github.com/stashapp/stash/pkg/models" "github.com/stashapp/stash/pkg/scene" + "github.com/stashapp/stash/pkg/utils" ) const ( @@ -67,7 +68,7 @@ func getPathWords(path string) []string { // just use the first two characters // #2293 - need to convert to unicode runes for the substring, otherwise // the resulting string is corrupted. - ret = append(ret, string([]rune(w)[0:2])) + ret = utils.StrAppendUnique(ret, string([]rune(w)[0:2])) } } @@ -90,13 +91,7 @@ func nameMatchesPath(name, path string) int { // #2363 - optimisation: only use unicode character regexp if path contains // unicode characters re := nameToRegexp(name, !allASCII(path)) - found := re.FindAllStringIndex(path, -1) - - if found == nil { - return -1 - } - - return found[len(found)-1][0] + return regexpMatchesPath(re, path) } // nameToRegexp compiles a regexp pattern to match paths from the given name. diff --git a/pkg/match/path_test.go b/pkg/match/path_test.go index c162b8feb..f31aa2885 100644 --- a/pkg/match/path_test.go +++ b/pkg/match/path_test.go @@ -54,6 +54,12 @@ func Test_nameMatchesPath(t *testing.T) { "before_first last/after", 6, }, + { + "within string case insensitive", + name, + "before FIRST last/after", + 6, + }, { "not within string", name, From bd917fdc641074b1f48b28a8f745837f7776cea1 Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Wed, 16 Mar 2022 09:21:30 +1100 Subject: [PATCH 2/3] Add hotfix version entry --- ui/v2.5/src/components/Changelog/Changelog.tsx | 11 +++++++++-- ui/v2.5/src/components/Changelog/versions/v0131.md | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 ui/v2.5/src/components/Changelog/versions/v0131.md diff --git a/ui/v2.5/src/components/Changelog/Changelog.tsx b/ui/v2.5/src/components/Changelog/Changelog.tsx index ffd212a0c..7d3f25c77 100644 --- a/ui/v2.5/src/components/Changelog/Changelog.tsx +++ b/ui/v2.5/src/components/Changelog/Changelog.tsx @@ -16,6 +16,7 @@ import V0100 from "./versions/v0100.md"; import V0110 from "./versions/v0110.md"; import V0120 from "./versions/v0120.md"; import V0130 from "./versions/v0130.md"; +import V0131 from "./versions/v0131.md"; import { MarkdownPage } from "../Shared/MarkdownPage"; // to avoid use of explicit any @@ -54,9 +55,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.13.0"; + const currentVersion = stashVersion || "v0.13.1"; const currentDate = buildDate; - const currentPage = V0130; + const currentPage = V0131; const releases: IStashRelease[] = [ { @@ -65,6 +66,12 @@ const Changelog: React.FC = () => { page: currentPage, defaultOpen: true, }, + { + version: "v0.13.0", + date: "2022-03-08", + page: V0130, + defaultOpen: true, + }, { version: "v0.12.0", date: "2021-12-29", diff --git a/ui/v2.5/src/components/Changelog/versions/v0131.md b/ui/v2.5/src/components/Changelog/versions/v0131.md new file mode 100644 index 000000000..4eeb5c06c --- /dev/null +++ b/ui/v2.5/src/components/Changelog/versions/v0131.md @@ -0,0 +1,2 @@ +### 🐛 Bug fixes +* Fix auto-tag not using case-insensitive matching. ([#2378](https://github.com/stashapp/stash/pull/2378)) \ No newline at end of file From c4ee40a4cb13559dcedb59d393d7cf7fd962c43c Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Wed, 16 Mar 2022 17:01:14 +1100 Subject: [PATCH 3/3] Remove redundant changelog entry --- ui/v2.5/src/components/Changelog/versions/v0140.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ui/v2.5/src/components/Changelog/versions/v0140.md b/ui/v2.5/src/components/Changelog/versions/v0140.md index adb5928ed..8d3e1a33d 100644 --- a/ui/v2.5/src/components/Changelog/versions/v0140.md +++ b/ui/v2.5/src/components/Changelog/versions/v0140.md @@ -5,5 +5,4 @@ ### 🐛 Bug fixes * Removed warnings and incorrect error message in json scrapers. ([#2375](https://github.com/stashapp/stash/pull/2375)) * Ensure identify continues using other scrapers if a scrape returns no results. ([#2375](https://github.com/stashapp/stash/pull/2375)) -* Continue trying to identify scene if scraper fails. ([#2375](https://github.com/stashapp/stash/pull/2375)) -* Fix auto-tag not using case-insensitive matching. ([#2378](https://github.com/stashapp/stash/pull/2378)) \ No newline at end of file +* Continue trying to identify scene if scraper fails. ([#2375](https://github.com/stashapp/stash/pull/2375)) \ No newline at end of file