Skip to content

Commit 9270f21

Browse files
jason-rlclaude
andauthored
Add content-type input with smart auto-detection (#11)
- 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 9270f21

6 files changed

Lines changed: 207 additions & 62 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: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,13 @@ 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(
130+
client,
131+
tarPath,
132+
inputs.objectTtlDays,
133+
inputs.isPublic,
134+
inputs.contentType
135+
);
130136

131137
// Create agent with object source
132138
// Using client.api.post because SDK v1.0.0 types are missing 'version' field in AgentCreateParams
@@ -173,7 +179,8 @@ async function deployFileAgent(
173179
client,
174180
filePath,
175181
inputs.objectTtlDays,
176-
inputs.isPublic
182+
inputs.isPublic,
183+
inputs.contentType
177184
);
178185

179186
// Create agent with object source

0 commit comments

Comments
 (0)