File tree Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @scaleway/regex ' : minor
3+ ---
4+
5+ fix: absolute path is more permissive
Original file line number Diff line number Diff line change @@ -961,7 +961,7 @@ describe('@regex', () => {
961961 } )
962962 } )
963963
964- describe . only ( 'pathSegment' , ( ) => {
964+ describe ( 'pathSegment' , ( ) => {
965965 test . each ( [
966966 [ '/hello' , false ] ,
967967 [ 'hello' , true ] ,
@@ -974,14 +974,20 @@ describe('@regex', () => {
974974 } )
975975 } )
976976
977- describe . only ( 'absolutePath' , ( ) => {
977+ describe ( 'absolutePath' , ( ) => {
978978 test . each ( [
979979 [ '/hello' , true ] ,
980+ [ '/a' , true ] ,
980981 [ 'hello' , false ] ,
981- [ '/hello nop' , false ] ,
982+ [ '/hello nop' , true ] ,
982983 [ '/hello?' , false ] ,
983984 [ '/hello-world' , true ] ,
984985 [ '/hello/world' , true ] ,
986+ [
987+ `/hello/world
988+ ciao/test` ,
989+ false ,
990+ ] ,
985991 ] ) ( 'should match regex %s to be %s' , ( string , expected ) => {
986992 expect ( absolutePath . test ( string ) ) . toBe ( expected )
987993 } )
Original file line number Diff line number Diff line change @@ -83,5 +83,4 @@ export const dashedIpv4 =
8383 / ( \b 2 5 [ 0 - 5 ] | \b 2 [ 0 - 4 ] [ 0 - 9 ] | \b [ 0 1 ] ? [ 0 - 9 ] [ 0 - 9 ] ? ) ( - ( 2 5 [ 0 - 5 ] | 2 [ 0 - 4 ] [ 0 - 9 ] | [ 0 1 ] ? [ 0 - 9 ] [ 0 - 9 ] ? ) ) { 3 } /
8484
8585export const pathSegment = / ^ [ _ a - z A - Z 0 - 9 ] [ - _ . a - z A - Z 0 - 9 ] * [ _ a - z A - Z 0 - 9 ] $ /
86- export const absolutePath =
87- / ^ \/ ( [ _ a - z A - Z 0 - 9 ] [ - _ . a - z A - Z 0 - 9 ] * [ _ a - z A - Z 0 - 9 ] \/ ? ) { 1 , 10 } $ /
86+ export const absolutePath = / ^ \/ ( ( [ \w . - ] * ) [ ^ \s ? ] \/ ? ) + $ /
You can’t perform that action at this time.
0 commit comments