diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d291b02..6c9fed2 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 + 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