Skip to content

Commit 543b9bc

Browse files
jason-rlclaude
andcommitted
Add content-type input with smart auto-detection
- Add `content-type` input to override auto-detected content type - Include `unspecified` as a valid value (matches backend/frontend) - Rewrite `determineContentType` to verify file contents against extensions using magic bytes: gzip header (1f 8b), tar header (ustar at offset 257), and decompressed tar-inside-gzip check - Warn when extension doesn't match actual file contents - Fall back to content-based heuristics when no extension matches Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 09ceb41 commit 543b9bc

6 files changed

Lines changed: 194 additions & 59 deletions

File tree

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ inputs:
5656
description: 'Path to file or tar archive (required if source-type=tar/file)'
5757
required: false
5858

59+
content-type:
60+
description: 'Object content type override (unspecified, text, binary, gzip, tar, tgz). If omitted, auto-detected from file extension and magic bytes.'
61+
required: false
62+
5963
# Common inputs
6064
setup-commands:
6165
description: 'Newline-separated setup commands to run after agent installation'

dist/index.js

Lines changed: 90 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/agent-deployer.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ async function deployTarAgent(
126126
const tarPath = resolvePath(inputs.path);
127127

128128
// Upload tar file
129-
const uploadResult = await uploadTarFile(client, tarPath, inputs.objectTtlDays, inputs.isPublic);
129+
const uploadResult = await uploadTarFile(client, tarPath, inputs.objectTtlDays, inputs.isPublic, inputs.contentType);
130130

131131
// Create agent with object source
132132
// Using client.api.post because SDK v1.0.0 types are missing 'version' field in AgentCreateParams
@@ -173,7 +173,8 @@ async function deployFileAgent(
173173
client,
174174
filePath,
175175
inputs.objectTtlDays,
176-
inputs.isPublic
176+
inputs.isPublic,
177+
inputs.contentType,
177178
);
178179

179180
// Create agent with object source

0 commit comments

Comments
 (0)