Skip to content

file_path parameter is deprecated and requests will start erroring #511

@jwilsjustin

Description

@jwilsjustin

Describe the bug
We recieved this email from Nylas support:

Hello,

Our internal alerting has flagged your system as sending invalid fields to our API. Our system is currently ignoring those invalid fields and fulfilling the API request, but we will be releasing an update in the future that will begin to deny API requests with invalid payloads. Please correct this to prevent any disruption.

The Nylas v3 API is receiving the following invalid field in your sending API payloads: "file_path"

You may have meant "filename"

Upon further inspection, this gem is the source of the file_path parameter via the Nylas::FileUtils.attach_file_request_builder method.

def self.attach_file_request_builder(file_path, filename = nil, content_id = nil)
filename ||= File.basename(file_path)
content_type = MIME::Types.type_for(file_path)
content_type = if !content_type.nil? && !content_type.empty?
content_type.first.to_s
else
"application/octet-stream"
end
size = File.size(file_path)
content = File.new(file_path, "rb")
{
filename: filename,
content_type: content_type,
size: size,
content: content,
content_id: content_id,
file_path: file_path
}

Image

SDK Version:
We are on 6.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions