fixes avatar commit

This commit is contained in:
Paul Schneider 2016-09-23 12:32:17 +02:00
commit cb0a40c489
2 changed files with 11 additions and 11 deletions

View file

@ -149,6 +149,8 @@ namespace Yavsc.Migrations
b.Property<int>("AccessFailedCount"); b.Property<int>("AccessFailedCount");
b.Property<string>("Avatar");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken(); .IsConcurrencyToken();

View file

@ -11,26 +11,24 @@ namespace Yavsc
public partial class Startup public partial class Startup
{ {
public static string UserFilesDirName { get; private set; } public static string UserFilesDirName { get; private set; }
public static FileServerOptions UserFilesOptions { get; private set; }
public void ConfigureFileServerApp(IApplicationBuilder app, public void ConfigureFileServerApp(IApplicationBuilder app,
SiteSettings siteSettings, IHostingEnvironment env) SiteSettings siteSettings, IHostingEnvironment env)
{ {
var rootPath = Path.Combine( UserFilesDirName = Path.Combine(
env.WebRootPath, env.WebRootPath,
// TODO: add a ressource serveur id here, siteSettings.UserFiles.DirName);
// or remove the blog entry id usage, to use the userid instead
// and an user defined optional subdir. var rootInfo = new DirectoryInfo(UserFilesDirName);
siteSettings.UserFiles.DirName
);
var rootInfo = new DirectoryInfo(rootPath);
if (!rootInfo.Exists) rootInfo.Create(); if (!rootInfo.Exists) rootInfo.Create();
UserFilesOptions = new FileServerOptions()
app.UseFileServer(new FileServerOptions()
{ {
FileProvider = new PhysicalFileProvider(rootPath), FileProvider = new PhysicalFileProvider(UserFilesDirName),
RequestPath = new PathString("/" + siteSettings.UserFiles.DirName), RequestPath = new PathString("/" + siteSettings.UserFiles.DirName),
EnableDirectoryBrowsing = env.IsDevelopment() EnableDirectoryBrowsing = env.IsDevelopment()
}); };
app.UseFileServer(UserFilesOptions);
app.UseStaticFiles(); app.UseStaticFiles();
} }
} }