From e6d03f67377d4412c7aa56a8e2e4988e6ec479dd Mon Sep 17 00:00:00 2001 From: Daniel Kennedy Date: Wed, 11 Mar 2026 08:57:07 -0400 Subject: [PATCH] Add a regression test for artifact name + content-type mismatches (#472) * Add a regression test for artifact name + content-type mismatches * Specify that we want v4 in a comment * Fix the expected type --- .github/workflows/test.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d291b02..ccd6379 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -154,3 +154,36 @@ jobs: } Write-Host "Successfully downloaded artifact without decompressing: $rawFile (size: $($fileInfo.Length) bytes)" shell: pwsh + + # Regression test for artifact filename vs content-type mismatch + # When an archived artifact has a name with a file extension that doesn't + # match the blob type (e.g. "report.txt" but blob is zip), the server + # should append .zip to the content-disposition filename. + - name: Create and upload archived artifact with misleading extension + shell: bash + run: | + mkdir -p path/to/extension-test + echo '{"key": "value"}' > path/to/extension-test/data.json + - uses: actions/upload-artifact@v4 # V4 is important here to ensure we're supporting older versions correctly + with: + name: report.txt-${{ matrix.runs-on }}.json + path: path/to/extension-test/data.json + + - name: Download misleading-extension artifact without decompressing + uses: ./ + with: + name: report.txt-${{ matrix.runs-on }}.json + path: ext-test/raw + skip-decompress: true + + - name: Verify downloaded file has .zip extension appended + shell: bash + run: | + expected="ext-test/raw/report.txt-${{ matrix.runs-on }}.json.zip" + if [ -f "$expected" ]; then + echo "PASS: Downloaded file has .zip appended: $expected" + else + echo "FAIL: Expected $expected but got:" + ls -al ext-test/raw/ + exit 1 + fi