Browse Source
Merge pull request #15729 from abpframework/issue-15694
Encode URL before saving it into database
pull/15770/head
Engincan VESKE
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
4 additions and
1 deletions
-
modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Edit.cshtml.cs
-
modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/New.cshtml.cs
|
|
@ -50,6 +50,7 @@ namespace Volo.Blogging.Pages.Blog.Posts |
|
|
var postDto = await _postAppService.GetAsync(new Guid(PostId)); |
|
|
var postDto = await _postAppService.GetAsync(new Guid(PostId)); |
|
|
Post = ObjectMapper.Map<PostWithDetailsDto, EditPostViewModel>(postDto); |
|
|
Post = ObjectMapper.Map<PostWithDetailsDto, EditPostViewModel>(postDto); |
|
|
Post.Tags = String.Join(", ", postDto.Tags.Select(p => p.Name).ToArray()); |
|
|
Post.Tags = String.Join(", ", postDto.Tags.Select(p => p.Name).ToArray()); |
|
|
|
|
|
Post.Url = WebUtility.UrlDecode(Post.Url); |
|
|
|
|
|
|
|
|
return Page(); |
|
|
return Page(); |
|
|
} |
|
|
} |
|
|
@ -60,7 +61,7 @@ namespace Volo.Blogging.Pages.Blog.Posts |
|
|
{ |
|
|
{ |
|
|
BlogId = Post.BlogId, |
|
|
BlogId = Post.BlogId, |
|
|
Title = Post.Title, |
|
|
Title = Post.Title, |
|
|
Url = Post.Url, |
|
|
Url = WebUtility.UrlEncode(Post.Url), |
|
|
CoverImage = Post.CoverImage, |
|
|
CoverImage = Post.CoverImage, |
|
|
Content = Post.Content, |
|
|
Content = Post.Content, |
|
|
Tags = Post.Tags, |
|
|
Tags = Post.Tags, |
|
|
|
|
|
@ -66,6 +66,8 @@ namespace Volo.Blogging.Pages.Blog.Posts |
|
|
Post.Description = Post.Content.Truncate(PostConsts.MaxSeoFriendlyDescriptionLength); |
|
|
Post.Description = Post.Content.Truncate(PostConsts.MaxSeoFriendlyDescriptionLength); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Post.Url = WebUtility.UrlEncode(Post.Url); |
|
|
|
|
|
|
|
|
var postWithDetailsDto = await _postAppService.CreateAsync(ObjectMapper.Map<CreatePostViewModel, CreatePostDto>(Post)); |
|
|
var postWithDetailsDto = await _postAppService.CreateAsync(ObjectMapper.Map<CreatePostViewModel, CreatePostDto>(Post)); |
|
|
|
|
|
|
|
|
//TODO: Try Url.Page(...)
|
|
|
//TODO: Try Url.Page(...)
|
|
|
|