GithubHelp home page GithubHelp logo

jastbytes / pliksharp Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 2.0 17 KB

A .NET API client for Plik, the scalable & friendly temporary file upload system, written in C#

License: MIT License

C# 100.00%
api-client dotnet filesharing plik

pliksharp's People

Contributors

iss0 avatar jastbytes avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

pliksharp's Issues

Serialization exception when the filesize exceeds Int32.MaxValue (2147483647)

Sample code:

private static string Upload(string plikEndpoint, int ttlInSeconds, string filePath)
{
    var plikApi = RestService.For<IPlikApi>(plikEndpoint);
    var uploadRequest = new UploadRequest()
    {
        OneShot = false,
        Removable = true,
        Ttl = ttlInSeconds
    };
    var uploadMetadata = plikApi.CreateUploadAsync(uploadRequest).Result;
    using (var file = File.OpenRead(filePath))
    {
        var streamPart = new StreamPart(file, Path.GetFileName(filePath));
        var uploadFile = plikApi.UploadFileAsync(uploadMetadata.Id, uploadMetadata.UploadToken, streamPart).Result;
        return uploadFile.DownloadUrl(uploadMetadata.Id);
    }
}

The following exception is thrown:

Unhandled exception. System.AggregateException: One or more errors occurred. (JSON integer 2817915216 is too large or small for an Int32. Path 'fileSize', line 1, position 236.)
---> Newtonsoft.Json.JsonReaderException: JSON integer 2817915216 is too large or small for an Int32. Path 'fileSize', line 1, position 236.
at Newtonsoft.Json.JsonTextReader.ParseReadNumber(ReadType readType, Char firstChar, Int32 initialPosition)
at Newtonsoft.Json.JsonTextReader.ParseNumber(ReadType readType)
at Newtonsoft.Json.JsonTextReader.ReadNumberValue(ReadType readType)
at Newtonsoft.Json.JsonTextReader.ReadAsInt32()
at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
at Refit.RequestBuilderImplementation.<>c__DisplayClass11_0`1.<b__0>d.MoveNext() in C:\projects\refit\Refit\RequestBuilderImplementation.cs:line 275
--- End of inner exception stack trace ---

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.