Browse Source
Merge pull request #1048 from Webdiyer/master
UrlEncode post url within Redirect method in blogging module
pull/1050/head
maliming
8 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
3 additions and
2 deletions
-
modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Edit.cshtml.cs
-
modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml.cs
|
|
|
@ -1,6 +1,7 @@ |
|
|
|
using System; |
|
|
|
using System.ComponentModel.DataAnnotations; |
|
|
|
using System.Linq; |
|
|
|
using System.Net; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
@ -61,7 +62,7 @@ namespace Volo.Blogging.Pages.Blog.Posts |
|
|
|
var editedPost = await _postAppService.UpdateAsync(Post.Id, post); |
|
|
|
var blog = await _blogAppService.GetAsync(editedPost.BlogId); |
|
|
|
|
|
|
|
return Redirect(Url.Content($"~/blog/{blog.ShortName}/{editedPost.Url}")); |
|
|
|
return Redirect(Url.Content($"~/blog/{WebUtility.UrlEncode(blog.ShortName)}/{WebUtility.UrlEncode(editedPost.Url)}")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -54,7 +54,7 @@ namespace Volo.Blogging.Pages.Blog.Posts |
|
|
|
var postWithDetailsDto = await _postAppService.CreateAsync(ObjectMapper.Map<CreatePostViewModel,CreatePostDto>(Post)); |
|
|
|
|
|
|
|
//TODO: Try Url.Page(...)
|
|
|
|
return Redirect(Url.Content($"~/blog/{blog.ShortName}/{postWithDetailsDto.Url}")); |
|
|
|
return Redirect(Url.Content($"~/blog/{WebUtility.UrlEncode(blog.ShortName)}/{WebUtility.UrlEncode(postWithDetailsDto.Url)}")); |
|
|
|
} |
|
|
|
|
|
|
|
public class CreatePostViewModel |
|
|
|
|