From cfd029a6172a5953a988c8aff008d87f9fb75669 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Jul 2026 08:28:28 +0000 Subject: [PATCH 1/4] Initial plan From fe8263daa6b929e225b2b6558942b165906cfe21 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Jul 2026 08:34:20 +0000 Subject: [PATCH 2/4] [AppService] Fix zip deploy content-type header --- .../cli/command_modules/appservice/custom.py | 5 +++- .../latest/test_webapp_commands_thru_mock.py | 30 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/appservice/custom.py b/src/azure-cli/azure/cli/command_modules/appservice/custom.py index fe3ec65ac8b..571c333645a 100644 --- a/src/azure-cli/azure/cli/command_modules/appservice/custom.py +++ b/src/azure-cli/azure/cli/command_modules/appservice/custom.py @@ -11361,7 +11361,10 @@ def _build_deploymentstatus_url(cmd, resource_group_name, webapp_name, slot, dep def _get_ondeploy_headers(params): if params.src_path: - content_type = 'application/octet-stream' + if params.artifact_type == 'zip': + content_type = 'application/zip' + else: + content_type = 'application/octet-stream' elif params.src_url: content_type = 'application/json' else: diff --git a/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_commands_thru_mock.py b/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_commands_thru_mock.py index cc19fbcb865..22c56edfad5 100644 --- a/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_commands_thru_mock.py +++ b/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_commands_thru_mock.py @@ -1088,6 +1088,36 @@ def _make_params(self): params.slot = None return params + @mock.patch('azure.cli.command_modules.appservice.custom._populate_cached_scm_headers') + @mock.patch('azure.cli.command_modules.appservice.custom.get_scm_site_headers', return_value={}) + def test_get_ondeploy_headers_uses_zip_content_type_for_zip_artifact( + self, get_scm_site_headers_mock, _populate_cached_headers_mock): + from azure.cli.command_modules.appservice.custom import _get_ondeploy_headers + params = self._make_params() + params.src_path = '/tmp/package.zip' + params.artifact_type = 'zip' + + _get_ondeploy_headers(params) + + sent_additional_headers = get_scm_site_headers_mock.call_args.kwargs['additional_headers'] + self.assertEqual(sent_additional_headers['Content-Type'], 'application/zip') + self.assertEqual(sent_additional_headers['Cache-Control'], 'no-cache') + + @mock.patch('azure.cli.command_modules.appservice.custom._populate_cached_scm_headers') + @mock.patch('azure.cli.command_modules.appservice.custom.get_scm_site_headers', return_value={}) + def test_get_ondeploy_headers_keeps_octet_stream_for_non_zip_artifact( + self, get_scm_site_headers_mock, _populate_cached_headers_mock): + from azure.cli.command_modules.appservice.custom import _get_ondeploy_headers + params = self._make_params() + params.src_path = '/tmp/package.war' + params.artifact_type = 'war' + + _get_ondeploy_headers(params) + + sent_additional_headers = get_scm_site_headers_mock.call_args.kwargs['additional_headers'] + self.assertEqual(sent_additional_headers['Content-Type'], 'application/octet-stream') + self.assertEqual(sent_additional_headers['Cache-Control'], 'no-cache') + def test_get_or_fetch_scm_url_derives_from_cached_site(self): from azure.cli.command_modules.appservice.custom import _get_or_fetch_scm_url from azure.mgmt.web.models import HostType From 65741d412f5b579b8a447ae13f16f852a60c7d05 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Jul 2026 10:39:31 +0000 Subject: [PATCH 3/4] [AppService] Re-run CI after flaky Homebrew timeout From f2841b16ef248e32b7f5eb587030aca656ca4e72 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 4 Aug 2026 04:59:10 +0000 Subject: [PATCH 4/4] Normalize artifact_type case when selecting zip Content-Type Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com> --- .../azure/cli/command_modules/appservice/custom.py | 2 +- .../tests/latest/test_webapp_commands_thru_mock.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/appservice/custom.py b/src/azure-cli/azure/cli/command_modules/appservice/custom.py index 8bd337857bc..4eb68e1a37c 100644 --- a/src/azure-cli/azure/cli/command_modules/appservice/custom.py +++ b/src/azure-cli/azure/cli/command_modules/appservice/custom.py @@ -11644,7 +11644,7 @@ def _build_deploymentstatus_url(cmd, resource_group_name, webapp_name, slot, dep def _get_ondeploy_headers(params): if params.src_path: - if params.artifact_type == 'zip': + if (params.artifact_type or '').strip().lower() == 'zip': content_type = 'application/zip' else: content_type = 'application/octet-stream' diff --git a/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_commands_thru_mock.py b/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_commands_thru_mock.py index e3e9390a602..05b7df3aa38 100644 --- a/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_commands_thru_mock.py +++ b/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_commands_thru_mock.py @@ -1474,6 +1474,20 @@ def test_get_ondeploy_headers_uses_zip_content_type_for_zip_artifact( self.assertEqual(sent_additional_headers['Content-Type'], 'application/zip') self.assertEqual(sent_additional_headers['Cache-Control'], 'no-cache') + @mock.patch('azure.cli.command_modules.appservice.custom._populate_cached_scm_headers') + @mock.patch('azure.cli.command_modules.appservice.custom.get_scm_site_headers', return_value={}) + def test_get_ondeploy_headers_zip_content_type_is_case_insensitive( + self, get_scm_site_headers_mock, _populate_cached_headers_mock): + from azure.cli.command_modules.appservice.custom import _get_ondeploy_headers + params = self._make_params() + params.src_path = '/tmp/package.zip' + params.artifact_type = 'ZIP' + + _get_ondeploy_headers(params) + + sent_additional_headers = get_scm_site_headers_mock.call_args.kwargs['additional_headers'] + self.assertEqual(sent_additional_headers['Content-Type'], 'application/zip') + @mock.patch('azure.cli.command_modules.appservice.custom._populate_cached_scm_headers') @mock.patch('azure.cli.command_modules.appservice.custom.get_scm_site_headers', return_value={}) def test_get_ondeploy_headers_keeps_octet_stream_for_non_zip_artifact(