@@ -77,17 +77,12 @@ public async Task<IActionResult> Run(
77
77
return new BadRequestErrorMessageResult ( string . Join ( NewLine , errors ) ) ;
78
78
}
79
79
80
- if ( Uri . TryCreate ( form [ "redirect" ] , Absolute , out var redirectUri ) )
81
- {
82
- return new RedirectResult ( redirectUri . ToString ( ) ) ;
83
- }
84
-
85
80
return new OkResult ( ) ;
86
81
}
87
82
88
83
private bool IsNotCommentFromCorrectSite ( IFormCollection form )
89
84
{
90
- if ( ! Uri . TryCreate ( form [ "comment-site " ] , Absolute , out var postedCommentSite ) )
85
+ if ( ! Uri . TryCreate ( form [ "commentSite " ] , Absolute , out var postedCommentSite ) )
91
86
{
92
87
return true ;
93
88
}
@@ -129,7 +124,7 @@ private async Task<CreateFileRequest> CreateCommentFile(
129
124
Reference prBranch ,
130
125
Comment comment )
131
126
{
132
- var commitMessage = $ "Comment by { comment . name } on { comment . post_id } ";
127
+ var commitMessage = $ "Comment by { comment . name } on { comment . PostId } ";
133
128
var commentContent = new SerializerBuilder ( ) . Build ( ) . Serialize ( comment ) ;
134
129
var commenterEmail = comment . email ?? _committerFallbackEmail ;
135
130
@@ -138,7 +133,7 @@ private async Task<CreateFileRequest> CreateCommentFile(
138
133
Committer = new Committer ( comment . name , commenterEmail , comment . date )
139
134
} ;
140
135
141
- var commentFilePath = $ "_data/comments/{ comment . post_id } /{ comment . id } .yml";
136
+ var commentFilePath = $ "_data/comments/{ comment . PostId } /{ comment . id } .yml";
142
137
143
138
await _githubRepoClient . Content . CreateFile ( repo . Id , commentFilePath , fileRequest ) ;
144
139
@@ -171,27 +166,27 @@ private class Comment
171
166
private static readonly ParameterInfo [ ] _ctorParameters = _ctor . GetParameters ( ) ;
172
167
173
168
// Valid characters when mapping from the blog post slug to a file path
174
- private static readonly Regex _validPathChars = new Regex ( @"[^a-zA-Z0-9-]" , Compiled ) ;
169
+ private static readonly Regex _invalidPathChars = new Regex ( @"[^a-zA-Z0-9-]" , Compiled ) ;
175
170
private static readonly Regex _emailMatcher = new Regex ( @"^[^@\s]+@[^@\s]+\.[^@\s]+$" , Compiled ) ;
176
171
177
172
public Comment (
178
- string post_id ,
173
+ string postId ,
179
174
string message ,
180
175
string name ,
181
176
string email = null ,
182
177
Uri url = null ,
183
178
string avatar = null )
184
179
{
185
- this . post_id = _validPathChars . Replace ( post_id , "-" ) ;
180
+ PostId = _invalidPathChars . Replace ( postId , "-" ) ;
186
181
this . message = message ;
187
182
this . name = name ;
188
183
this . email = email ;
189
184
this . url = url ;
190
185
191
186
date = DateTime . UtcNow ;
192
- id = new { this . post_id , this . name , this . message , this . date } . GetHashCode ( ) . ToString ( "x8" ) ;
187
+ id = new { post_id = PostId , name , message , date } . GetHashCode ( ) . ToString ( "x8" ) ;
193
188
194
- if ( Uri . TryCreate ( avatar , Absolute , out Uri avatarUrl ) )
189
+ if ( Uri . TryCreate ( avatar , Absolute , out var avatarUrl ) )
195
190
{
196
191
this . avatar = avatarUrl ;
197
192
}
@@ -238,7 +233,7 @@ public static bool TryCreate(
238
233
239
234
private static object GetParameterValue ( IFormCollection form , ParameterInfo parameter )
240
235
{
241
- var value = form [ parameter . Name ] ;
236
+ var value = form [ parameter . Name ] . ToString ( ) ;
242
237
243
238
if ( string . IsNullOrWhiteSpace ( value ) )
244
239
{
@@ -255,7 +250,7 @@ private static object GetParameterFallbackValue(ParameterInfo parameter)
255
250
#endregion
256
251
257
252
[ YamlIgnore ]
258
- public string post_id { get ; }
253
+ public string PostId { get ; }
259
254
260
255
public string id { get ; }
261
256
0 commit comments