diff --git a/.github/workflows/docker-weekly.yml b/.github/workflows/docker-weekly.yml deleted file mode 100644 index f62f2dd48..000000000 --- a/.github/workflows/docker-weekly.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: weekly docker build - -on: - schedule: - # Monday midnight - - cron: '0 0 * * 1' - workflow_dispatch: - -permissions: - packages: write - contents: write - id-token: write - -jobs: - weekly-container-build: - uses: ./.github/workflows/reusable-container-workflow.yaml - with: - build_type: dev - tag: ${{ github.sha}} - tag_latest: true - image: ghcr.io/dragonflydb/dragonfly-weekly - registry: ghcr.io - registry_username: ${{ github.repository_owner }} - secrets: - registry_password: ${{ secrets.GITHUB_TOKEN }} diff --git a/src/core/dfly_core_test.cc b/src/core/dfly_core_test.cc index d80eb56b8..e9e40c291 100644 --- a/src/core/dfly_core_test.cc +++ b/src/core/dfly_core_test.cc @@ -230,7 +230,7 @@ TEST_F(IntentLockTest, Basic) { class StringMatchTest : public ::testing::Test { protected: // wrapper around stringmatchlen with stringview arguments - int MatchLen(string_view pattern, string_view str, bool nocase) { + bool MatchLen(string_view pattern, string_view str, bool nocase) { GlobMatcher matcher(pattern, !nocase); return matcher.Matches(str); } @@ -247,6 +247,11 @@ TEST_F(StringMatchTest, Glob2Regex) { EXPECT_EQ(GlobMatcher::Glob2Regex("[^]a"), ".a"); EXPECT_EQ(GlobMatcher::Glob2Regex("[]a"), "[]a"); EXPECT_EQ(GlobMatcher::Glob2Regex("\\d"), "d"); + EXPECT_EQ(GlobMatcher::Glob2Regex("[\\d]"), "[\\\\d]"); + + reflex::Matcher matcher("abc[\\\\d]e"); + matcher.input("abcde"); + ASSERT_TRUE(matcher.find()); } TEST_F(StringMatchTest, Basic) { @@ -289,9 +294,10 @@ TEST_F(StringMatchTest, Basic) { } TEST_F(StringMatchTest, Special) { - EXPECT_EQ(MatchLen("h\\[^|", "h[^|", 0), 1); - EXPECT_EQ(MatchLen("[^", "[^", 0), 0); - EXPECT_EQ(MatchLen("[$?^]a", "?a", 0), 1); + EXPECT_TRUE(MatchLen("h\\[^|", "h[^|", 0)); + EXPECT_FALSE(MatchLen("[^", "[^", 0)); + EXPECT_TRUE(MatchLen("[$?^]a", "?a", 0)); + EXPECT_TRUE(MatchLen("abc[\\d]e", "abcde", 0)); } using benchmark::DoNotOptimize; diff --git a/src/core/glob_matcher.cc b/src/core/glob_matcher.cc index caf874392..d82a330d3 100644 --- a/src/core/glob_matcher.cc +++ b/src/core/glob_matcher.cc @@ -31,6 +31,9 @@ string GlobMatcher::Glob2Regex(string_view glob) { in_group = 0; } regex.push_back(c); + if (c == '\\') { + regex.push_back(c); // escape it. + } continue; }