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
commit 9800a3f35c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -50,6 +50,7 @@ namespace Volo.Blogging.Pages.Blog.Posts
var postDto = await _postAppService.GetAsync(new Guid(PostId));
Post = ObjectMapper.Map<PostWithDetailsDto, EditPostViewModel>(postDto);
Post.Tags = String.Join(", ", postDto.Tags.Select(p => p.Name).ToArray());
Post.Url = WebUtility.UrlDecode(Post.Url);
return Page();
}
@ -60,7 +61,7 @@ namespace Volo.Blogging.Pages.Blog.Posts
{
BlogId = Post.BlogId,
Title = Post.Title,
Url = Post.Url,
Url = WebUtility.UrlEncode(Post.Url),
CoverImage = Post.CoverImage,
Content = Post.Content,
Tags = Post.Tags,

@ -66,6 +66,8 @@ namespace Volo.Blogging.Pages.Blog.Posts
Post.Description = Post.Content.Truncate(PostConsts.MaxSeoFriendlyDescriptionLength);
}
Post.Url = WebUtility.UrlEncode(Post.Url);
var postWithDetailsDto = await _postAppService.CreateAsync(ObjectMapper.Map<CreatePostViewModel, CreatePostDto>(Post));
//TODO: Try Url.Page(...)

Loading…
Cancel
Save