Skip to content

Commit abede59

Browse files
committed
Updates to storage provider
1 parent 46507bc commit abede59

File tree

5 files changed

+40
-17
lines changed

5 files changed

+40
-17
lines changed

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
<h3 align="center">Blogifier</h3>
99
<p align="center">
10-
Blogifier is an open-source publishing platform written in ASP.NET and Blazor WebAssembly.<br>
11-
Right now with Blogifier, you can make a personal blog, and more features are under development.<br><br>
10+
Blogifier is self hosted open source publishing platform written in ASP.NET and Blazor WebAssembly.<br>
11+
Right now Blogifier can be used as a personal or group blog, and more features are under development.<br><br>
1212
<a href="https://blogifier.net/"><b>Official Website »</b></a>
1313
&nbsp;&nbsp;
1414
<a href="https://demo.blogifier.net/"><b>Live Demo »</b></a>
@@ -21,12 +21,7 @@
2121
</p>
2222

2323
<br><br>
24-
> **Blogifier is under development** <br>
25-
Code in the main branch is under development and some features are not yet implemented and may not work as expected.
26-
If you are looking for a stable application, please use [latest release](https://github.com/blogifierdotnet/Blogifier/releases).
27-
The latest stable source code is in the [master branch](https://github.com/blogifierdotnet/Blogifier/tree/5c9bab69788a1f7a0bd82c6a864e159eff5b1b72). Please note that newest code uses Blazor Web Assembly and not compatible with previous versions.
2824

29-
<br><br>
3025
## Installation
3126

3227
This version is built and compiled, and ready to use:

src/Blogifier.Admin/Components/Blog/CategoriesComponent.razor

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
@inject HttpClient _http
22
@inject IStringLocalizer<Resource> _localizer
33
<style>
4-
.bf-test { color: red !important }
4+
.editor-add-category {
5+
color: #FFF;
6+
overflow: hidden;
7+
background-color: transparent;
8+
border: none;
9+
outline: none;
10+
font-weight: 600;
11+
font-size: 0.95em;
12+
}
513
</style>
614
<div class="d-flex">
715
@if (PostCategories != null)
@@ -16,7 +24,7 @@
1624
</div>
1725
}
1826
}
19-
<input type="text" id="add_category_control" class="bf-test" @bind="Tag" @onkeyup="KeyPressed" name="tagItem" placeholder="@_localizer["add-category"]" />
27+
<input type="text" id="add_category_control" class="editor-add-category" @bind="Tag" @onkeyup="KeyPressed" name="tagItem" placeholder="@_localizer["add-category"]" />
2028
</div>
2129

2230
@code {

src/Blogifier.Core/Blogifier.Core.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
<PropertyGroup>
44
<TargetFramework>net6.0</TargetFramework>
5-
<Version>2.9.1.5</Version>
5+
<Version>2.9.2.0</Version>
66
<Authors>blogifierdotnet</Authors>
7-
<Description>Blogifier is an open-source publishing platform Written in .NET 5.0 and Blazor WebAssembly.</Description>
7+
<Description>Blogifier is an open-source publishing platform Written in ASP.NET and Blazor WebAssembly.</Description>
88
<Copyright>Blogifier.Net</Copyright>
99
<PackageProjectUrl>https://blogifier.net</PackageProjectUrl>
1010
<RepositoryUrl>https://github.com/blogifierdotnet/Blogifier</RepositoryUrl>

src/Blogifier.Core/Providers/StorageProvider.cs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,21 @@ public async Task<bool> UploadFormFile(IFormFile file, string path = "")
107107
Path.Combine(_storageRoot, fileName) :
108108
Path.Combine(_storageRoot, path + _slash + fileName);
109109

110-
using (var fileStream = new FileStream(filePath, FileMode.Create))
110+
Serilog.Log.Information($"Storage root: {_storageRoot}");
111+
Serilog.Log.Information($"Uploading file: {filePath}");
112+
try
113+
{
114+
using (var fileStream = new FileStream(filePath, FileMode.Create))
115+
{
116+
await file.CopyToAsync(fileStream);
117+
Serilog.Log.Information($"Uploaded file: {filePath}");
118+
}
119+
}
120+
catch (Exception ex)
111121
{
112-
await file.CopyToAsync(fileStream);
122+
Serilog.Log.Error($"Error uploading file: {ex.Message}");
113123
}
124+
114125
return true;
115126
}
116127

@@ -178,19 +189,28 @@ private string ContentRoot
178189
string testsDirectory = $"tests{_slash}Blogifier.Tests";
179190
string appDirectory = $"src{_slash}Blogifier";
180191

192+
Serilog.Log.Information($"Current directory path: {path}");
193+
181194
// development unit test run
182195
if (path.LastIndexOf(testsDirectory) > 0)
183196
{
184197
path = path.Substring(0, path.LastIndexOf(testsDirectory));
198+
Serilog.Log.Information($"Unit test path: {path}src{_slash}Blogifier");
185199
return $"{path}src{_slash}Blogifier";
186200
}
187201

188-
// development debug run
202+
// this needed to make sure we have correct data directory
203+
// when running in debug mode in Visual Studio
204+
// so instead of debug (src/Blogifier/bin/Debug..)
205+
// will be used src/Blogifier/wwwroot/data
206+
// !! this can mess up installs that have "src/Blogifier" in the path !!
189207
if (path.LastIndexOf(appDirectory) > 0)
190208
{
191209
path = path.Substring(0, path.LastIndexOf(appDirectory));
210+
Serilog.Log.Information($"Development debug path: {path}src{_slash}Blogifier");
192211
return $"{path}src{_slash}Blogifier";
193212
}
213+
Serilog.Log.Information($"Final path: {path}");
194214
return path;
195215
}
196216
}

tests/Blogifier.Tests/Blogifier.Tests.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
8+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
99
<PackageReference Include="xunit" Version="2.4.1" />
1010
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
1111
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1212
<PrivateAssets>all</PrivateAssets>
1313
</PackageReference>
14-
<PackageReference Include="coverlet.collector" Version="1.3.0">
14+
<PackageReference Include="coverlet.collector" Version="3.1.1">
1515
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1616
<PrivateAssets>all</PrivateAssets>
1717
</PackageReference>

0 commit comments

Comments
 (0)