File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed
Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ function urlNoProtocal(url) {
4343}
4444
4545function urlAlias ( url ) {
46- const regex = / h t t p s ? : \/ \/ | w w w \. | \? .+ | # .+ | \/ $ / g;
46+ const regex = / h t t p s ? : \/ \/ | w w w \. | \? .+ | # .+ | i n d e x \. h t m l | \/ $ / g;
4747 url = url . replace ( regex , '' ) ;
4848 // Replace one more time
4949 url = url . replace ( regex , '' ) ;
@@ -92,7 +92,8 @@ function validateCategory(tag) {
9292}
9393
9494function validateTag ( tag ) {
95- return / ^ [ a - z 0 - 9 ] [ a - z 0 - 9 - ] * [ a - z 0 - 9 ] $ / . test ( tag ) ;
95+ const validTags = [ 'c++' , 'c/c++' , 'c#' , '.net' ] ;
96+ return / ^ [ a - z 0 - 9 ] [ a - z 0 - 9 - ] * [ a - z 0 - 9 ] $ / . test ( tag ) || validTags . includes ( tag ) ;
9697}
9798
9899function stringify ( doc , key ) {
@@ -117,6 +118,7 @@ function validate(doc, options) {
117118 }
118119
119120 try {
121+ doc . url = doc . url . replace ( / i n d e x \. h t m l / g, '' ) ;
120122 doc . url = new URL ( doc . url ) . href ;
121123 } catch ( _ ) {
122124 throw new TypeError ( 'invalid url.' + stringify ( doc , 'url' ) ) ;
Original file line number Diff line number Diff line change 11{
22 "name" : " dev-blog-directory-save" ,
3- "version" : " 0.4.3 " ,
3+ "version" : " 0.4.4 " ,
44 "description" : " API for save new blogs to dev-blog-directory." ,
55 "main" : " lib/index.js" ,
66 "scripts" : {
Original file line number Diff line number Diff line change @@ -454,7 +454,9 @@ describe('dev-blog-directory-save', () => {
454454 'foo-foo' ,
455455 'FOO-Bar' ,
456456 'foo,bar' ,
457- [ 'foo-bar' , 'A-TAG' ]
457+ [ 'foo-bar' , 'A-TAG' ] ,
458+ 'c++' ,
459+ [ 'c++' , 'c/c++' , 'c#' , '.net' ]
458460 ] ;
459461
460462 validTags . forEach ( ( tags , i ) => {
You can’t perform that action at this time.
0 commit comments