a fork of iceshrimp.net but a tweaked frontend to my personal liking. waow
fediverse social-media social iceshrimp fedi
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[frontend/core] Remove client-size upload size limit

+21 -4
+20 -3
Iceshrimp.Frontend/Components/Compose.razor
··· 493 493 UploadingFiles += e.FileCount; 494 494 foreach (var file in e.GetMultipleFiles()) 495 495 { 496 - try { 496 + try 497 + { 497 498 var res = await ApiService.Drive.UploadFileAsync(file); 498 499 Attachments.Add(res); 499 500 } 500 - catch (IOException exception) 501 + catch (ApiException ex) when (ex.Response.StatusCode is 413 && ex.Response.Details is { Length: > 0 } details) 501 502 { 502 - await GlobalComponentSvc.NoticeDialog?.Display(exception.Message, NoticeDialog.NoticeType.Error)!; 503 + const string prefix = "The media upload size limit is set to "; 504 + const string suffix = " bytes."; 505 + string msg; 506 + if (details.StartsWith(prefix) && long.TryParse(details[prefix.Length..^suffix.Length], out var bytes)) 507 + msg = Loc["Attachment is too large. The server set this limit to {0} bytes.", bytes.ToString()]; //TODO: fix grammar 508 + else 509 + msg = Loc["Attachment is too large."]; 510 + 511 + await GlobalComponentSvc.NoticeDialog?.Display(msg, NoticeDialog.NoticeType.Error)!; 512 + } 513 + catch (ApiException ex) 514 + { 515 + await GlobalComponentSvc.NoticeDialog?.Display(ex.Response.Message ?? ex.Message, NoticeDialog.NoticeType.Error)!; 516 + } 517 + catch (Exception ex) 518 + { 519 + await GlobalComponentSvc.NoticeDialog?.Display(ex.Message, NoticeDialog.NoticeType.Error)!; 503 520 } 504 521 505 522 UploadingFiles -= 1;
+1 -1
Iceshrimp.Frontend/Core/Services/ApiClient.cs
··· 99 99 { 100 100 request.Content = new MultipartFormDataContent 101 101 { 102 - new StreamContent(file.OpenReadStream(1024 * 1024 * 50)) 102 + new StreamContent(file.OpenReadStream(long.MaxValue)) 103 103 { 104 104 Headers = 105 105 {