@@ -6,6 +6,9 @@ async function main() {
66 let numInfiniteRedirects = 0 ;
77 let numUrlsWithFragment = 0 ;
88 let numDuplicateRedirects = 0 ;
9+ let numNonSlashedRedirects = 0 ;
10+
11+ const validEndings = [ "/" , "*" , ".xml" , ".md" , ".json" , ".html" ] ;
912
1013 const redirectSourceUrls : string [ ] = [ ] ;
1114
@@ -24,6 +27,11 @@ async function main() {
2427 numUrlsWithFragment ++ ;
2528 }
2629
30+ if ( ! validEndings . some ( ( ending ) => from . endsWith ( ending ) ) ) {
31+ console . log ( `✘ Found unslashed source URLs:\n ${ from } ` ) ;
32+ numNonSlashedRedirects ++ ;
33+ }
34+
2735 if ( redirectSourceUrls . includes ( from ) ) {
2836 console . log ( `✘ Found repeated source URL:\n ${ from } ` ) ;
2937 numDuplicateRedirects ++ ;
@@ -32,7 +40,12 @@ async function main() {
3240 }
3341 }
3442
35- if ( numInfiniteRedirects || numUrlsWithFragment || numDuplicateRedirects ) {
43+ if (
44+ numInfiniteRedirects ||
45+ numUrlsWithFragment ||
46+ numDuplicateRedirects ||
47+ numNonSlashedRedirects
48+ ) {
3649 console . log ( "\nDetected errors:" ) ;
3750
3851 if ( numInfiniteRedirects > 0 ) {
@@ -47,6 +60,12 @@ async function main() {
4760 console . log ( `- ${ numDuplicateRedirects } repeated source URL(s)` ) ;
4861 }
4962
63+ if ( numNonSlashedRedirects > 0 ) {
64+ console . log (
65+ `- ${ numNonSlashedRedirects } need slashes at the end of the source URL` ,
66+ ) ;
67+ }
68+
5069 console . log ( "\nPlease fix the errors above before merging :)" ) ;
5170 process . exit ( 1 ) ;
5271 } else {
0 commit comments