Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.278.1"
".": "1.278.2"
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT
PATH
remote: .
specs:
increase (1.278.1)
increase (1.278.2)
cgi
connection_pool
standardwebhooks
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
<!-- x-release-please-start-version -->

```ruby
gem "increase", "~> 1.278.1"
gem "increase", "~> 1.278.2"
```

<!-- x-release-please-end -->
Expand Down
20 changes: 17 additions & 3 deletions lib/increase/internal/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand All @@ -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<String>]
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/increase/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Increase
VERSION = "1.278.1"
VERSION = "1.278.2"
end
8 changes: 8 additions & 0 deletions rbi/increase/internal/util.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions sig/increase/internal/util.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down