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 +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/aris/plugins/multipart.rb +12 -4
- data/lib/aris/router.rb +7 -0
- data/lib/aris/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 177c81e9724b54870daf6b964a57dd9fd3266c7aba9a33e6e2ad86739a03abfa
|
|
4
|
+
data.tar.gz: f3cb1744bd6822871889d9e8e8d3b59c3e26dd02409bd9de5f6e8824cb4a6760
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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