From d8251140e890802c5624f40b3809ec3640b25c59 Mon Sep 17 00:00:00 2001 From: Samuel Paluba Date: Sun, 15 Nov 2026 05:15:22 +0100 Subject: [PATCH] fix: preserve explicit asset upload content type --- .codex-plugin/plugin.json | 2 +- docs/VERIFICATION.md | 6 ++++-- scripts/operations.py | 3 ++- tests/test_operations.py | 7 +++++++ wiki/Verification.md | 6 ++++-- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json index 362750e..4510b09 100644 --- a/.codex-plugin/plugin.json +++ b/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "full-github", - "version": "0.2.0", + "version": "0.2.1", "description": "Source-backed GitHub capability discovery and execution for Codex, including repository, organization and enterprise workflows.", "author": { "name": "ThinkHome", diff --git a/docs/VERIFICATION.md b/docs/VERIFICATION.md index d26363a..06e9595 100644 --- a/docs/VERIFICATION.md +++ b/docs/VERIFICATION.md @@ -1,6 +1,6 @@ # Verification record -## Version 0.2.0 +## Version 0.2.1 Verification date is 2026-11-15 on GitHub.com, repository thinkhome-org/full-github and organization Project 5. @@ -13,9 +13,11 @@ Verification date is 2026-11-15 on GitHub.com, repository thinkhome-org/full-git - Eighteen confirmed retired REST operations carry closure/replacement metadata and are blocked by the executor. - Current Projects view CRUD and status-update CRUD were confirmed in the live schema. Earlier blanket UI-only guidance has been corrected. +Version 0.2.1 additionally preserves an explicit upload Content-Type header when a caller selects an asset MIME type. + ## Automated checks -- 24 unit tests cover parameter boundaries, path/query encoding, body handling, binary upload host/media type, dry-run, remote exit status, retirement blocking, schema coverage, documented array filters, real-gh binary download byte preservation, pagination, empty responses, failures, classic branch protection and inaccessible Projects. +- 25 unit tests cover parameter boundaries, path/query encoding, body handling, binary upload host/media type, dry-run, remote exit status, retirement blocking, schema coverage, documented array filters, real-gh binary download byte preservation, pagination, empty responses, failures, classic branch protection and inaccessible Projects. - Manifest, capability schema, unique IDs, retired metadata and GraphQL root/type consistency are validated. - Generated capability and operation directories are checked for drift. diff --git a/scripts/operations.py b/scripts/operations.py index 9b2ec67..a9c1fa1 100644 --- a/scripts/operations.py +++ b/scripts/operations.py @@ -82,7 +82,8 @@ def build_request(operation, parameters, body=None, extra_headers=()): command.extend(["--paginate", "--slurp"]) if body is not None: content_types = operation.get("body_content_types", []) - if content_types and "application/json" not in content_types: + has_content_type = any(header.lower().startswith("content-type:") for header in headers[1::2]) + if content_types and "application/json" not in content_types and not has_content_type: command.extend(["-H", f"Content-Type: {content_types[0]}"]) command.extend(["--input", "-"]) return command diff --git a/tests/test_operations.py b/tests/test_operations.py index 7f04284..296d2f4 100644 --- a/tests/test_operations.py +++ b/tests/test_operations.py @@ -64,6 +64,13 @@ def test_binary_upload_uses_upload_host_and_content_type(self): self.assertTrue(argv[4].startswith("https://uploads.github.com/")) self.assertIn("Content-Type: application/octet-stream", argv) + def test_explicit_upload_content_type_is_preserved(self): + argv = module.build_request(self.catalog["repos/upload-release-asset"], + {"owner": "o", "repo": "r", "release_id": 1, "name": "a.zip"}, b"zip", + extra_headers=["Content-Type: application/zip"]) + self.assertIn("Content-Type: application/zip", argv) + self.assertNotIn("Content-Type: application/octet-stream", argv) + def test_retired_operation_never_reaches_network(self): with mock.patch("sys.argv", ["operations.py", "call", "dependency-graph/export-sbom"]), mock.patch.object(module.subprocess, "run") as run: with contextlib.redirect_stderr(io.StringIO()): diff --git a/wiki/Verification.md b/wiki/Verification.md index d26363a..06e9595 100644 --- a/wiki/Verification.md +++ b/wiki/Verification.md @@ -1,6 +1,6 @@ # Verification record -## Version 0.2.0 +## Version 0.2.1 Verification date is 2026-11-15 on GitHub.com, repository thinkhome-org/full-github and organization Project 5. @@ -13,9 +13,11 @@ Verification date is 2026-11-15 on GitHub.com, repository thinkhome-org/full-git - Eighteen confirmed retired REST operations carry closure/replacement metadata and are blocked by the executor. - Current Projects view CRUD and status-update CRUD were confirmed in the live schema. Earlier blanket UI-only guidance has been corrected. +Version 0.2.1 additionally preserves an explicit upload Content-Type header when a caller selects an asset MIME type. + ## Automated checks -- 24 unit tests cover parameter boundaries, path/query encoding, body handling, binary upload host/media type, dry-run, remote exit status, retirement blocking, schema coverage, documented array filters, real-gh binary download byte preservation, pagination, empty responses, failures, classic branch protection and inaccessible Projects. +- 25 unit tests cover parameter boundaries, path/query encoding, body handling, binary upload host/media type, dry-run, remote exit status, retirement blocking, schema coverage, documented array filters, real-gh binary download byte preservation, pagination, empty responses, failures, classic branch protection and inaccessible Projects. - Manifest, capability schema, unique IDs, retired metadata and GraphQL root/type consistency are validated. - Generated capability and operation directories are checked for drift.