Add a regression test for artifact name + content-type mismatches

This commit is contained in:
Daniel Kennedy
2026-03-10 20:47:39 -04:00
parent 70fc10c6e5
commit 88b0a35773

View File

@@ -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
with:
name: report.txt-${{ matrix.runs-on }}
path: path/to/extension-test/data.json
- name: Download misleading-extension artifact without decompressing
uses: ./
with:
name: report.txt-${{ matrix.runs-on }}
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 }}.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