Skip to content

Commit 3befe5c

Browse files
committed
Fix bug in file manager
1 parent b83330b commit 3befe5c

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

src/Core/Constants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ public class Constants
44
{
55
public static string NewestVersion = "last-version";
66
public static string UpgradeDirectory = "_upgrade";
7+
public static string DefaultAvatar = "lib/img/avatar.png";
78
}
89
}

src/Core/Data/Repositories/AuthorRepository.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public async Task Save(Author author)
6363
if (author.Created == DateTime.MinValue)
6464
{
6565
author.DisplayName = author.AppUserName;
66+
author.Avatar = Constants.DefaultAvatar;
6667
author.Created = SystemClock.Now();
6768
await _db.Authors.AddAsync(author);
6869
}

src/Core/Services/StorageService.cs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -410,19 +410,22 @@ List<AssetItem> MapFilesToAssets(IList<string> assets)
410410
{
411411
var items = new List<AssetItem>();
412412

413-
foreach (var asset in assets)
413+
if (assets != null && assets.Any())
414414
{
415-
// Azure puts web sites under "wwwroot" folder
416-
var path = asset.Replace($"wwwroot{_separator}wwwroot", "wwwroot", StringComparison.OrdinalIgnoreCase);
417-
418-
items.Add(new AssetItem {
419-
Path = asset,
420-
Url = pathToUrl(path),
421-
Title = pathToTitle(path),
422-
Image = pathToImage(path)
423-
});
424-
}
415+
foreach (var asset in assets)
416+
{
417+
// Azure puts web sites under "wwwroot" folder
418+
var path = asset.Replace($"wwwroot{_separator}wwwroot", "wwwroot", StringComparison.OrdinalIgnoreCase);
425419

420+
items.Add(new AssetItem
421+
{
422+
Path = asset,
423+
Url = pathToUrl(path),
424+
Title = pathToTitle(path),
425+
Image = pathToImage(path)
426+
});
427+
}
428+
}
426429
return items;
427430
}
428431

0 commit comments

Comments
 (0)