fixes avatar commit

main
Paul Schneider 9 years ago
parent 682a2a3873
commit 9f2ce20071
2 changed files with 11 additions and 11 deletions

@ -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();

@ -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.
siteSettings.UserFiles.DirName
);
var rootInfo = new DirectoryInfo(rootPath);
if (!rootInfo.Exists) rootInfo.Create();
var rootInfo = new DirectoryInfo(UserFilesDirName);
if (!rootInfo.Exists) rootInfo.Create();
app.UseFileServer(new FileServerOptions() UserFilesOptions = 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();
} }
} }

Loading…