na 1.2.92 → 1.2.93

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34119e46896bef108bcd426961bff8809cd81ef75054984d4735a84fbe8cdc58
4
- data.tar.gz: 6d9d1c2faffce4ba6d4cab6f75ccb2c3364c9ced1b9a0552097189431a5faff9
3
+ metadata.gz: d71185523bd5dc5bd29bca30dda53bedc598c7cd3df911aff0e6cfd6a1adb8cd
4
+ data.tar.gz: 388f8288110e0510397d9a7aa8fc75fc13305725c6dfdac10363274a4b2b6aef
5
5
  SHA512:
6
- metadata.gz: e87485d65980548a49de41456198dceef2497c3b907285da0a98def36a6836ccc5ba65c1d7457d65ff0be51157e0ba3ca06593fff0d4c57afe89db5d5f9fe2aa
7
- data.tar.gz: d8b96dad65a1119ae604c2e27f876bdd7b3db7b5d0a0f4945e5cad429764823e635c2687510f3dc09cd8a7e92c55b4945666a12f597e60b2c28aee27c1e9db7a
6
+ metadata.gz: 2b045eef10b1132aa64324d3e62f1910ac1e0754f60ee4b368ed85d841f594c5c2a960c908bd04966cdfc223752b54e2ee67a9f60b9960d684868daefcdbef0a
7
+ data.tar.gz: 8289a691269c86e829ae8e2abc48a97a0cf680240837f0fbdd48dbfe0f83feb65fb9fb729811253f22ab93215556b46321cfc3914b7dfb0fc8fbec1adf1b3cc7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### 1.2.93
2
+
3
+ 2025-11-29 21:51
4
+
5
+ #### FIXED
6
+
7
+ - Search strings containing special regex characters no longer cause RegexpError when regex option is false.
8
+
1
9
  ### 1.2.92
2
10
 
3
11
  2025-11-16 10:32
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- na (1.2.92)
4
+ na (1.2.93)
5
5
  chronic (~> 0.10, >= 0.10.2)
6
6
  csv (>= 3.2)
7
7
  git (~> 3.0.0)
data/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  _If you're one of the rare people like me who find this useful, feel free to
10
10
  [buy me some coffee][donate]._
11
11
 
12
- The current version of `na` is 1.2.92.
12
+ The current version of `na` is 1.2.93.
13
13
 
14
14
 
15
15
  ### Table of contents
@@ -116,7 +116,7 @@ SYNOPSIS
116
116
  na [global options] command [command options] [arguments...]
117
117
 
118
118
  VERSION
119
- 1.2.92
119
+ 1.2.93
120
120
 
121
121
  GLOBAL OPTIONS
122
122
  -a, --add - Add a next action (deprecated, for backwards compatibility)
data/lib/na/todo.rb CHANGED
@@ -94,8 +94,11 @@ module NA
94
94
  optional_tag.push({ tag: t })
95
95
  end
96
96
  end
97
+ # Track whether strings came from direct path (need escaping) or parse_search (already processed)
98
+ strings_from_direct_path = false
97
99
  unless settings[:search].nil? || (settings[:search].respond_to?(:empty?) && settings[:search].empty?)
98
100
  if settings[:regex] || settings[:search].is_a?(String)
101
+ strings_from_direct_path = true
99
102
  if settings[:negate]
100
103
  negated.push(settings[:search])
101
104
  else
@@ -113,9 +116,31 @@ module NA
113
116
  end
114
117
 
115
118
  # Pre-compile regexes for better performance
116
- optional = optional.map { |rx| rx.is_a?(Regexp) ? rx : Regexp.new(rx, Regexp::IGNORECASE) }
117
- required = required.map { |rx| rx.is_a?(Regexp) ? rx : Regexp.new(rx, Regexp::IGNORECASE) }
118
- negated = negated.map { |rx| rx.is_a?(Regexp) ? rx : Regexp.new(rx, Regexp::IGNORECASE) }
119
+ # When regex is false and string came from direct path, escape special characters
120
+ # When regex is true, use as-is (it's already a regex pattern)
121
+ # Strings from parse_search are already processed by wildcard_to_rx, so use as-is
122
+ compile_regex = lambda do |rx|
123
+ if rx.is_a?(Regexp)
124
+ rx
125
+ elsif settings[:regex]
126
+ Regexp.new(rx, Regexp::IGNORECASE)
127
+ elsif strings_from_direct_path
128
+ Regexp.new(Regexp.escape(rx.to_s), Regexp::IGNORECASE)
129
+ else
130
+ # From parse_search, already processed by wildcard_to_rx
131
+ # Try to compile as-is, but if it fails, escape it (handles edge cases with special chars)
132
+ begin
133
+ Regexp.new(rx, Regexp::IGNORECASE)
134
+ rescue RegexpError
135
+ # If compilation fails, escape the string (fallback for edge cases)
136
+ Regexp.new(Regexp.escape(rx.to_s), Regexp::IGNORECASE)
137
+ end
138
+ end
139
+ end
140
+
141
+ optional = optional.map(&compile_regex)
142
+ required = required.map(&compile_regex)
143
+ negated = negated.map(&compile_regex)
119
144
 
120
145
  files = if !settings[:file_path].nil?
121
146
  [settings[:file_path]]
data/lib/na/version.rb CHANGED
@@ -5,5 +5,5 @@
5
5
  module Na
6
6
  ##
7
7
  # Current version of the na gem.
8
- VERSION = '1.2.92'
8
+ VERSION = '1.2.93'
9
9
  end
data/src/_README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  _If you're one of the rare people like me who find this useful, feel free to
10
10
  [buy me some coffee][donate]._
11
11
 
12
- The current version of `na` is <!--VER-->1.2.91<!--END VER-->.
12
+ The current version of `na` is <!--VER-->1.2.92<!--END VER-->.
13
13
 
14
14
  <!--GITHUB-->
15
15
  ### Table of contents
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: na
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.92
4
+ version: 1.2.93
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra