This commit is contained in:
Paul Schneider 2021-05-13 23:05:19 +01:00
commit c2f38800aa
6 changed files with 75 additions and 58 deletions

View file

@ -20,20 +20,15 @@ namespace nuget_cli
FileInfo fi = new FileInfo(pkg);
if (!fi.Exists)
throw new Exception("Le fichier n'existe pas");
if (fi.Length > MAXSENDLEN)
throw new Exception($"Le fichier ne passe pas, trop gros ({MAXSENDLEN}).");
var fparams = new Dictionary<string, string> { };
using (var fss = fi.OpenRead())
{
try
{
byte[] buffer = new byte[MAXSENDLEN];
var form_bytes_read = fss.Read(buffer, 0, MAXSENDLEN);
report.UploadFilesToServer(new Uri(source),
fparams, fi.Name, "application/octet-stream",
apikey, buffer);
fparams, fi, "application/octet-stream",
apikey);
}
catch (WebException ex)
@ -52,7 +47,6 @@ namespace nuget_cli
await Console.Error.WriteLineAsync(ex.Message);
throw;
}
}
report.Executed = true;
return report;
}