Skip to content

Conversation

@stainless-app
Copy link

@stainless-app stainless-app bot commented Dec 30, 2025

Automated Release PR

0.1.0 (2025-12-30)

Full Changelog: v0.0.1...v0.1.0

Features

  • api: manual updates to open api (1de08df)
  • api: manual updates to openapi and stainless.yml (7e6b11f)
  • enhance Formo Analytics SDK with event batching, property normalization, and improved type definitions (1d1b771)
  • implement Formo Analytics SDK with event tracking and user identification (f985727)

Chores

  • add .stainless to gitignore (6a18355)
  • add contribution detail and stainless configuration files back (16f8e0d)
  • add readme (6a4b0e2)
  • consistent naming (96552ef)
  • consistent namings with the web sdk (b874115)
  • move typescript dependency to devDependencies (b32199b)
  • remove the .stainless (eb6b3ac)
  • sync repo (1d3ef06)
  • update client settings and remove ApiKeyAuth from security schemes (1bfa581)
  • update configuration and API references in stainless.yml and openapi.json (a149025)
  • Update dependencies and adjust test files and README. (60af9d2)
  • Update pnpm dependencies and add index.ts file (9b3dd7b)
  • update readme (b991924)
  • update readme on testing details (59dd823)
  • update the readme (614d0b5)
  • update traits to properties (130059e)

This pull request is managed by Stainless's GitHub App.

The semver version number is based on included commit messages. Alternatively, you can manually set the version number in the title of this pull request.

For a better experience, it is recommended to use either rebase-merge or squash-merge when merging this pull request.

🔗 Stainless website
📚 Read the docs
🙋 Reach out for help or questions

Comment on lines +113 to +116
const type = parts.find((part) => typeof part === 'object' && 'type' in part && part.type);
if (typeof type === 'string') {
options = { ...options, type };
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The parts.find() call returns a Blob object, but the subsequent check typeof type === 'string' expects a string, causing MIME type detection to always fail.
Severity: HIGH | Confidence: High

🔍 Detailed Analysis

The code attempts to automatically detect the MIME type from a Blob in the parts array. However, the parts.find() call returns the entire Blob object, which is assigned to the type variable. The subsequent condition if (typeof type === 'string') will always evaluate to false because type is an object, not a string. As a result, the intended MIME type is never extracted and applied to the File options, causing the automatic MIME type detection feature to silently fail. This can lead to files being sent with an incorrect Content-Type header.

💡 Suggested Fix

After finding the part containing the type, extract the type property from the object before the conditional check. For example: const foundPart = parts.find(...); const type = typeof foundPart === 'object' && 'type' in foundPart ? foundPart.type : undefined; if (typeof type === 'string') { ... }.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/internal/to-file.ts#L113-L116

Potential issue: The code attempts to automatically detect the MIME type from a `Blob`
in the `parts` array. However, the `parts.find()` call returns the entire `Blob` object,
which is assigned to the `type` variable. The subsequent condition `if (typeof type ===
'string')` will always evaluate to false because `type` is an object, not a string. As a
result, the intended MIME type is never extracted and applied to the `File` options,
causing the automatic MIME type detection feature to silently fail. This can lead to
files being sent with an incorrect `Content-Type` header.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 502265

@yosriady yosriady closed this Dec 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants