Skip to content

Commit fc9e262

Browse files
kraju3AaronDDM
andauthored
Remove file_path from build JSON request (#512)
* Remove file_path from build JSON request * Updated unrelesed changelog --------- Co-authored-by: Aaron de Mello <314152+AaronDDM@users.noreply.github.com>
1 parent f4c6b89 commit fc9e262

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
### Unreleased
4+
* Removed `file_path` from `File` object to match the Send API schema
5+
36
### 6.2.3 / 2025-01-23
47
* Fixed issue where errors were not properly thrown due to an instance type of `String` instead of `Hash`
58

lib/nylas/utils/file_utils.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def self.build_json_request(attachments)
6262
opened_files = []
6363

6464
attachments.each_with_index do |attachment, _index|
65+
attachment.delete(:file_path)
6566
current_attachment = attachment[:content]
6667
next unless current_attachment
6768

spec/nylas/utils/file_utils_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,14 @@
165165
expect(opened_files).to include(mock_file)
166166
end
167167

168+
it "removed the file_path key from the attachment" do
169+
attachments = [{ content: mock_file, file_path: "/path/to/file.txt" }]
170+
171+
result, _opened_files = described_class.build_json_request(attachments)
172+
173+
expect(result.first).not_to have_key(:file_path)
174+
end
175+
168176
it "skips attachments with no content" do
169177
attachments = [{ content: nil }]
170178

0 commit comments

Comments
 (0)