Skip to content

fix: preserve Skills upload file paths#1856

Open
Genmin wants to merge 2 commits intoopenai:masterfrom
Genmin:fix/skills-preserve-file-paths
Open

fix: preserve Skills upload file paths#1856
Genmin wants to merge 2 commits intoopenai:masterfrom
Genmin:fix/skills-preserve-file-paths

Conversation

@Genmin
Copy link
Copy Markdown

@Genmin Genmin commented Apr 29, 2026

Fixes #1807.

This keeps the existing safe default for multipart uploads: filenames inferred from File, Response, stream path, or filename are still stripped down to their basename unless a caller opts out.

The Skills API is the exception because its upload contract requires files to live under a single top-level directory, such as my-skill/SKILL.md. skills.create() and skills.versions.create() now opt into preserving filename paths when constructing multipart form data.

Validation:

  • yarn test tests/form.test.ts

@Genmin Genmin requested a review from a team as a code owner April 29, 2026 23:03
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a20e148b58

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/internal/uploads.ts Outdated
'';

if (!name) return undefined;
if (opts?.stripFilename === false) return name;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Limit path-preserving mode to explicit file names

When stripFilename === false, this returns the raw value for every source (name, url, filename, and path), but Skills now enables that mode by default in both create calls. As a result, Response uploads use full URLs and stream uploads can use full filesystem paths (e.g., from fs.createReadStream(path.resolve(...))), which can violate the Skills “single top-level directory” filename contract and leak local paths in multipart metadata. Path-preserving mode should be restricted to caller-provided logical names, while inferred url/path values should still be reduced to a basename.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

skills.create: getName() strips directory paths from File names, breaking required directory structure

1 participant