From d78df6ce7d11866bc5f8ad6f8ba80813fd63bd79 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 31 Mar 2026 20:50:19 +0000 Subject: [PATCH 1/2] fix: align path encoding with RFC 3986 section 3.3 --- lib/increase/internal/util.rb | 20 +++++++++++++++++--- rbi/increase/internal/util.rbi | 8 ++++++++ sig/increase/internal/util.rbs | 4 ++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/lib/increase/internal/util.rb b/lib/increase/internal/util.rb index d5fb98ec..c5eff645 100644 --- a/lib/increase/internal/util.rb +++ b/lib/increase/internal/util.rb @@ -237,6 +237,11 @@ def dig(data, pick, &blk) end end + # @type [Regexp] + # + # https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3 + RFC_3986_NOT_PCHARS = /[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/ + class << self # @api private # @@ -247,6 +252,15 @@ def uri_origin(uri) "#{uri.scheme}://#{uri.host}#{":#{uri.port}" unless uri.port == uri.default_port}" end + # @api private + # + # @param path [String, Integer] + # + # @return [String] + def encode_path(path) + path.to_s.gsub(Increase::Internal::Util::RFC_3986_NOT_PCHARS) { ERB::Util.url_encode(_1) } + end + # @api private # # @param path [String, Array] @@ -259,7 +273,7 @@ def interpolate_path(path) in [] "" in [String => p, *interpolations] - encoded = interpolations.map { ERB::Util.url_encode(_1) } + encoded = interpolations.map { encode_path(_1) } format(p, *encoded) end end @@ -576,10 +590,10 @@ def encode_query_params(query) case val in Increase::FilePart unless val.filename.nil? - filename = ERB::Util.url_encode(val.filename) + filename = encode_path(val.filename) y << "; filename=\"#{filename}\"" in Pathname | IO - filename = ERB::Util.url_encode(::File.basename(val.to_path)) + filename = encode_path(::File.basename(val.to_path)) y << "; filename=\"#{filename}\"" else end diff --git a/rbi/increase/internal/util.rbi b/rbi/increase/internal/util.rbi index f5d9a4bf..252dc60c 100644 --- a/rbi/increase/internal/util.rbi +++ b/rbi/increase/internal/util.rbi @@ -148,12 +148,20 @@ module Increase end end + # https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3 + RFC_3986_NOT_PCHARS = T.let(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/, Regexp) + class << self # @api private sig { params(uri: URI::Generic).returns(String) } def uri_origin(uri) end + # @api private + sig { params(path: T.any(String, Integer)).returns(String) } + def encode_path(path) + end + # @api private sig { params(path: T.any(String, T::Array[String])).returns(String) } def interpolate_path(path) diff --git a/sig/increase/internal/util.rbs b/sig/increase/internal/util.rbs index cd751259..a30be396 100644 --- a/sig/increase/internal/util.rbs +++ b/sig/increase/internal/util.rbs @@ -45,8 +45,12 @@ module Increase -> top? } -> top? + RFC_3986_NOT_PCHARS: Regexp + def self?.uri_origin: (URI::Generic uri) -> String + def self?.encode_path: (String | Integer path) -> String + def self?.interpolate_path: (String | ::Array[String] path) -> String def self?.decode_query: (String? query) -> ::Hash[String, ::Array[String]] From 43dc169ac94ee7602cb3cd488274c1176e7dab8a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 31 Mar 2026 20:50:42 +0000 Subject: [PATCH 2/2] release: 1.278.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ Gemfile.lock | 2 +- README.md | 2 +- lib/increase/version.rb | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f1ce00f2..14b0e6b2 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.278.1" + ".": "1.278.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index f41201c5..57adfae0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.278.2 (2026-03-31) + +Full Changelog: [v1.278.1...v1.278.2](https://github.com/Increase/increase-ruby/compare/v1.278.1...v1.278.2) + +### Bug Fixes + +* align path encoding with RFC 3986 section 3.3 ([d78df6c](https://github.com/Increase/increase-ruby/commit/d78df6ce7d11866bc5f8ad6f8ba80813fd63bd79)) + ## 1.278.1 (2026-03-31) Full Changelog: [v1.278.0...v1.278.1](https://github.com/Increase/increase-ruby/compare/v1.278.0...v1.278.1) diff --git a/Gemfile.lock b/Gemfile.lock index 62b329a0..5f3fb308 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - increase (1.278.1) + increase (1.278.2) cgi connection_pool standardwebhooks diff --git a/README.md b/README.md index 670f1564..b838cfce 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "increase", "~> 1.278.1" +gem "increase", "~> 1.278.2" ``` diff --git a/lib/increase/version.rb b/lib/increase/version.rb index c81a5ff6..4bbf8e27 100644 --- a/lib/increase/version.rb +++ b/lib/increase/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Increase - VERSION = "1.278.1" + VERSION = "1.278.2" end