diff options
author | 杨宇千 <crupest@outlook.com> | 2019-10-17 15:13:41 +0800 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-10-17 15:13:41 +0800 |
commit | ea1e708f2fc179c5fc0bf1eda83482ad0ce7ea33 (patch) | |
tree | 7f19e86f51613b46d3ab3aff02b8abd9f71bb0b0 | |
parent | 7c021c429ea77dffdd877c3e2a0bcf6e881a7285 (diff) | |
download | timeline-ea1e708f2fc179c5fc0bf1eda83482ad0ce7ea33.tar.gz timeline-ea1e708f2fc179c5fc0bf1eda83482ad0ce7ea33.tar.bz2 timeline-ea1e708f2fc179c5fc0bf1eda83482ad0ce7ea33.zip |
...
-rw-r--r-- | Timeline.Tests/Mock/Data/TestDatabase.cs | 5 | ||||
-rw-r--r-- | Timeline/Controllers/UserAvatarController.cs | 3 | ||||
-rw-r--r-- | Timeline/Startup.cs | 13 | ||||
-rw-r--r-- | Timeline/Timeline.csproj | 2 | ||||
-rw-r--r-- | nuget.config | 1 |
5 files changed, 6 insertions, 18 deletions
diff --git a/Timeline.Tests/Mock/Data/TestDatabase.cs b/Timeline.Tests/Mock/Data/TestDatabase.cs index 7b4bc65e..dd04f8f9 100644 --- a/Timeline.Tests/Mock/Data/TestDatabase.cs +++ b/Timeline.Tests/Mock/Data/TestDatabase.cs @@ -1,6 +1,5 @@ using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Diagnostics;
using System;
using Timeline.Entities;
@@ -25,10 +24,6 @@ namespace Timeline.Tests.Mock.Data var options = new DbContextOptionsBuilder<DatabaseContext>()
.UseSqlite(_databaseConnection)
- .ConfigureWarnings(builder =>
- {
- builder.Throw(RelationalEventId.QueryClientEvaluationWarning);
- })
.Options;
_databaseContext = new DatabaseContext(options);
diff --git a/Timeline/Controllers/UserAvatarController.cs b/Timeline/Controllers/UserAvatarController.cs index e7e12d0b..e77076ca 100644 --- a/Timeline/Controllers/UserAvatarController.cs +++ b/Timeline/Controllers/UserAvatarController.cs @@ -122,7 +122,8 @@ namespace Timeline.Controllers return BadRequest(new CommonResponse(ErrorCodes.Put_Content_UnmatchedLength_Less,
$"Content length in header is {contentLength} but actual length is {bytesRead}."));
- if (Request.Body.ReadByte() != -1)
+ var extraByte = new byte[1];
+ if (await Request.Body.ReadAsync(extraByte) != 0)
return BadRequest(new CommonResponse(ErrorCodes.Put_Content_UnmatchedLength_Bigger,
$"Content length in header is {contentLength} but actual length is bigger than that."));
diff --git a/Timeline/Startup.cs b/Timeline/Startup.cs index f5ffe94e..7552df2e 100644 --- a/Timeline/Startup.cs +++ b/Timeline/Startup.cs @@ -2,10 +2,8 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Hosting;
using Timeline.Authenticate;
using Timeline.Configs;
using Timeline.Entities;
@@ -52,14 +50,7 @@ namespace Timeline services.AddDbContext<DatabaseContext>(options =>
{
- options.UseMySql(databaseConfig.ConnectionString)
- .ConfigureWarnings(warnings =>
- {
- if (Environment.IsProduction())
- warnings.Log(RelationalEventId.QueryClientEvaluationWarning);
- else
- warnings.Throw(RelationalEventId.QueryClientEvaluationWarning);
- });
+ options.UseMySql(databaseConfig.ConnectionString);
});
services.AddHttpClient();
@@ -78,9 +69,11 @@ namespace Timeline app.UseRouting();
app.UseAuthentication();
+ app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
+ endpoints.MapControllers();
});
}
}
diff --git a/Timeline/Timeline.csproj b/Timeline/Timeline.csproj index 836376d9..f01b8e31 100644 --- a/Timeline/Timeline.csproj +++ b/Timeline/Timeline.csproj @@ -13,7 +13,7 @@ </ItemGroup>
<ItemGroup>
- <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.2.0" />
+ <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.0.0-rc1.final" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql.Design" Version="1.1.2" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-dev002868" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.5.0" />
diff --git a/nuget.config b/nuget.config index e1fc7cfe..11533d59 100644 --- a/nuget.config +++ b/nuget.config @@ -3,7 +3,6 @@ <packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
- <add key="aspnetcore-dev" value="https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json" />
<add key="imagesharp-dev" value="https://www.myget.org/F/sixlabors/api/v3/index.json" />
</packageSources>
</configuration>
|