@@ -14,7 +14,7 @@ var internals = {};
14
14
exports . fileHandler = function ( route , options ) {
15
15
16
16
var settings = ( typeof options !== 'object' ? { path : options } : Utils . clone ( options ) ) ; // options can be reused
17
- Utils . assert ( typeof settings . path !== 'string' || settings . path [ settings . path . length - 1 ] !== '/' , 'File path cannot end with a \'/\'' ) ;
17
+ Utils . assert ( typeof settings . path !== 'string' || settings . path [ settings . path . length - 1 ] !== '/' , 'File path cannot end with a \'/\':' , route . path ) ;
18
18
19
19
var absolutePath = internals . absolutePath ( route ) ;
20
20
@@ -53,8 +53,8 @@ exports.fileHandler = function (route, options) {
53
53
54
54
exports . directoryHandler = function ( route , options ) {
55
55
56
- Utils . assert ( route . path [ route . path . length - 1 ] === '}' , 'The route path must end with a parameter' ) ;
57
- Utils . assert ( route . params . length >= 1 , 'The route path must include at least one parameter' ) ;
56
+ Utils . assert ( route . path [ route . path . length - 1 ] === '}' , 'The route path must end with a parameter:' , route . path ) ;
57
+ Utils . assert ( route . params . length >= 1 , 'The route path must include at least one parameter:' , route . path ) ;
58
58
59
59
var settings = Utils . clone ( options ) ; // options can be reused
60
60
var absolutePath = internals . absolutePath ( route ) ;
@@ -82,7 +82,7 @@ exports.directoryHandler = function (route, options) {
82
82
if ( Array . isArray ( settings . path ) ) {
83
83
settings . path . forEach ( function ( path ) {
84
84
85
- Utils . assert ( path && typeof path === 'string' , 'Directory path array must only contain strings' ) ;
85
+ Utils . assert ( path && typeof path === 'string' , 'Directory path array must only contain strings:' , route . path ) ;
86
86
normalized . push ( normalize ( path ) ) ;
87
87
} ) ;
88
88
}
@@ -127,8 +127,6 @@ exports.directoryHandler = function (route, options) {
127
127
128
128
internals . absolutePath = function ( route ) {
129
129
130
- var relativeTo = route . server . settings . files && route . server . settings . files . relativeTo ;
131
- Utils . assert ( relativeTo && ( relativeTo [ 0 ] === '/' || [ 'cwd' , 'routes' ] . indexOf ( relativeTo ) !== - 1 ) , 'Invalid server files.relativeTo configuration' ) ;
132
130
133
131
// Plugin
134
132
@@ -138,6 +136,7 @@ internals.absolutePath = function (route) {
138
136
139
137
// 'cwd'
140
138
139
+ var relativeTo = route . server . settings . files . relativeTo ;
141
140
if ( relativeTo === 'cwd' ) {
142
141
return '.' ;
143
142
}
0 commit comments