smartsheet / smartsheet-csharp-sdk

Library that uses C# to connect to Smartsheet services.
Apache License 2.0
12 stars 6 forks source link

Uploading attachements (excel and pdf) #51

Closed mermich closed 6 months ago

mermich commented 9 months ago

The newest versions of the API and more specificly the DefaultHttpClient changed the way parameters and files were sent over Smartsheet servers, corrupting them.

Reproduction steps and explainations will soon follow.

mermich commented 9 months ago

Here is the sample code used for both the 3.1.1 and 2.126.0 versions : ` private static void Main(string[] args) { Console.WriteLine("dmoe latest (wrong upload...)");

    // create client.
    var bld = new Smartsheet.Api.SmartsheetBuilder() { };
    bld.SetAccessToken("XXX");
    var client = bld.Build();

    // attach a random pdf
    client.SheetResources.AttachmentResources.AttachFile(0000, "C:\\source\\someDemo.pdf", "application/pdf");
}`

The pdfs are both created onto smartsheet, but the size are different and with the 3.1.1 version of the Smartsheet SDK, the file is correucpted and cannot be displyed in the browser or anywhere. The issue is related to the changes mades to the DefaultHttpClient, more specificly encoding the file...

rzaracota commented 6 months ago

Hi @mermich thank you for reporting this issue. With 3.1.2 we have updated the attachment uploading path associated with this call and I believe it will resolve your issue if you update but do please let us know if the issue remains

mermich commented 6 months ago

I upgraded my version of the nuget package and was able to corrrectly update attachments.