@@ -1163,6 +1163,31 @@ public async Task TestUploadFullPackage_FailsIfMetadataTooLong()
11631163 Assert . Contains ( "Beatmap difficulty names must not exceed 80 characters." , ( await response . Content . ReadFromJsonAsync < ErrorResponse > ( ) ) ! . Error ) ;
11641164 }
11651165
1166+ [ Fact ]
1167+ public async Task TestUploadFullPackage_FailsIfOsuFileFormatVersionTooOld ( )
1168+ {
1169+ using var db = await DatabaseAccess . GetConnectionAsync ( ) ;
1170+ await db . ExecuteAsync ( "INSERT INTO `phpbb_users` (`user_id`, `username`, `username_clean`, `country_acronym`, `user_permissions`, `user_sig`, `user_occ`, `user_interests`) VALUES (1000, 'test', 'test', 'JP', '', '', '', '')" ) ;
1171+
1172+ await db . ExecuteAsync ( @"INSERT INTO `osu_beatmapsets` (`beatmapset_id`, `user_id`, `creator`, `approved`, `thread_id`, `active`, `submit_date`) VALUES (241526, 1000, 'test user', -1, 0, -1, CURRENT_TIMESTAMP)" ) ;
1173+
1174+ foreach ( uint beatmapId in new uint [ ] { 557810 } )
1175+ await db . ExecuteAsync ( @"INSERT INTO `osu_beatmaps` (`beatmap_id`, `user_id`, `beatmapset_id`, `approved`) VALUES (@beatmapId, 1000, 241526, -1)" , new { beatmapId = beatmapId } ) ;
1176+
1177+ var request = new HttpRequestMessage ( HttpMethod . Put , "/beatmapsets/241526" ) ;
1178+
1179+ using var content = new MultipartFormDataContent ( $ "{ Guid . NewGuid ( ) } ----") ;
1180+ using var stream = TestResources . GetResource ( "old-osu-version.osz" ) ! ;
1181+ content . Add ( new StreamContent ( stream ) , "beatmapArchive" , osz_filename ) ;
1182+ request . Content = content ;
1183+ request . Headers . Add ( HeaderBasedAuthenticationHandler . USER_ID_HEADER , "1000" ) ;
1184+
1185+ var response = await Client . SendAsync ( request ) ;
1186+ Assert . False ( response . IsSuccessStatusCode ) ;
1187+ Assert . Equal ( HttpStatusCode . UnprocessableEntity , response . StatusCode ) ;
1188+ Assert . Contains ( "Version of file \" Soleily - Renatus (test) [old version].osu\" is too old (should be v14 or higher)" , ( await response . Content . ReadFromJsonAsync < ErrorResponse > ( ) ) ! . Error ) ;
1189+ }
1190+
11661191 [ Fact ]
11671192 public async Task TestPatchPackage ( )
11681193 {
0 commit comments