From 19f6f28f5cdcef7262feb98484a7601060b136d4 Mon Sep 17 00:00:00 2001 From: goingforstudying-ctrl Date: Tue, 23 Jun 2026 11:09:11 -0400 Subject: [PATCH] fix: revert accidental test change in context_test.go The TestSaveUploadedFileWithPermissionFailed change was unrelated to the SkipMethodNotAllowedMiddleware feature and caused CI failure on Go 1.25 with -tags nomsgpack. Restore the original require.Error assertion. --- context_test.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/context_test.go b/context_test.go index 444227ac..e8d305e4 100644 --- a/context_test.go +++ b/context_test.go @@ -271,14 +271,7 @@ func TestSaveUploadedFileWithPermissionFailed(t *testing.T) { assert.Equal(t, "permission_test", f.Filename) var mode fs.FileMode = 0o644 dst := filepath.Join(t.TempDir(), "test", "permission_test") - // The fix in #4702 only chmods the directory when it is newly created. - // When running as root, chmod on any directory succeeds, so this test - // cannot reliably assert failure. Instead, verify that the directory - // is created with the requested mode and the file is written correctly. - require.NoError(t, c.SaveUploadedFile(f, dst, mode)) - info, err := os.Stat(filepath.Dir(dst)) - require.NoError(t, err) - assert.Equal(t, mode, info.Mode().Perm()) + require.Error(t, c.SaveUploadedFile(f, dst, mode)) } // TestSaveUploadedFileToExistingDir is a regression test for issue #4622.