aris 1.5.0 → 1.5.1

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: 547d34f5d148e75eec825310ab4da2bd6e80b02710386b7655210f4d5291804b
4
- data.tar.gz: 41c84020f283351be32ff5b23444a4cc667e1034aec4f631efa586684c5f6833
3
+ metadata.gz: 177c81e9724b54870daf6b964a57dd9fd3266c7aba9a33e6e2ad86739a03abfa
4
+ data.tar.gz: f3cb1744bd6822871889d9e8e8d3b59c3e26dd02409bd9de5f6e8824cb4a6760
5
5
  SHA512:
6
- metadata.gz: e34a068d4a4cd75e4694686896c1a8596da07b55abb4c7dff4cae3ead8e1d62d7871c76dbdbdeed21be8a7a44b7f39f883dae9dadd129c76b9b1f5ad743ac753
7
- data.tar.gz: 591b1a14fb433f46da7907ade3167dee46dcee2fca40e6187a1bc748c7be3dd02ca9e93a9a6bc30393e5a35e37584eb8ba6519ebc7cc01cd7313c3237990767d
6
+ metadata.gz: ebd7ca4a073b9d073c192ce21bc84aaf831257968bb1f5f22c93a7eff45f6e57bc487944596aa7ad4881abe61a56db73b8fae4d5935455e102a4dce1804c0eab
7
+ data.tar.gz: 9ab6127bf992f2341bf827f063ad013795ecae774264207afdc3421d08c703daa56c644e1596dbd74d09dde18b78c0a6d61c4d6a38cf840fe43fb549dc4f9b89
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.5.1] - 2026-09-13
4
+
5
+ Text is text. Suite: 426 tests / 1294 assertions, green.
6
+
7
+ ### 🐛 Fixed
8
+
9
+ * **Path params and multipart fields came out as raw bytes (ASCII-8BIT).** Servers hand `PATH_INFO` and the request body over as binary strings, and aris passed them straight through. That is invisible until something cares about encoding: the `sqlite3` gem binds a binary string as a BLOB, so `WHERE book = ?` with a route param never matched, and a form value saved through a multipart form landed in the database as a BLOB instead of TEXT. Route params (`params[:book]`) and multipart field values, names and filenames are now UTF-8 text (invalid bytes are scrubbed). File data stays binary. Urlencoded forms were already fine (Rack decodes them as UTF-8).
10
+
3
11
  ## [1.5.0] - 2026-09-12
4
12
 
5
13
  Sessions you can build a login on, and Rack 3 correct responses. Suite: 424 tests / 1289 assertions, green.
@@ -151,11 +151,13 @@ module Aris
151
151
  content_type_match = headers_raw.match(/content-type:\s*(.+?)(?:\r?\n|$)/i)
152
152
  content_type = content_type_match ? content_type_match[1].strip : nil
153
153
 
154
+ # The body is raw bytes; names, filenames and text fields are text.
155
+ # A file's data stays binary.
154
156
  if filename
155
157
  # File upload
156
158
  parts << {
157
- name: name,
158
- filename: filename,
159
+ name: text(name),
160
+ filename: text(filename),
159
161
  content_type: content_type || 'application/octet-stream',
160
162
  data: content,
161
163
  type: :file
@@ -163,8 +165,8 @@ module Aris
163
165
  else
164
166
  # Regular form field
165
167
  parts << {
166
- name: name,
167
- data: content,
168
+ name: text(name),
169
+ data: text(content),
168
170
  type: :field
169
171
  }
170
172
  end
@@ -172,6 +174,12 @@ module Aris
172
174
 
173
175
  parts
174
176
  end
177
+
178
+ def text(str)
179
+ return str if str.nil? || str.encoding == Encoding::UTF_8
180
+ out = str.dup.force_encoding(Encoding::UTF_8)
181
+ out.valid_encoding? ? out : out.scrub
182
+ end
175
183
  end
176
184
  end
177
185
  end
data/lib/aris/router.rb CHANGED
@@ -696,6 +696,13 @@ module Aris
696
696
  path.length > 1 && path.end_with?('/') ? path.chomp('/') : path
697
697
  end
698
698
 
699
+ # Servers hand PATH_INFO over as raw bytes (ASCII-8BIT). Path params must be
700
+ # text: a binary "coop" is a BLOB to SQLite and never equals the text 'coop'.
701
+ unless normalized.encoding == Encoding::UTF_8
702
+ normalized = normalized.dup.force_encoding(Encoding::UTF_8)
703
+ normalized = normalized.scrub unless normalized.valid_encoding?
704
+ end
705
+
699
706
  if normalized.include?('%')
700
707
  begin
701
708
  normalized = URI.decode_www_form_component(normalized)
data/lib/aris/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Aris
2
- VERSION = "1.5.0"
2
+ VERSION = "1.5.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aris
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Garcia