File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -226,9 +226,16 @@ function doesPathExist(pathToCheck) {
226226}
227227
228228function validatePath ( value , helpers ) {
229- Joi . assert ( value , string . pattern ( / ^ [ \\ / ] $ | ( [ \\ / a - z A - Z _ 0 - 9 : - ] + ) + $ / , 'directory path' ) ) ;
229+ Joi . assert ( value , string . pattern ( / ^ [ \\ / ~ ] $ | ( [ \\ / ~ a - z A - Z _ 0 - 9 : - ] + ) + $ / , 'directory path' ) ) ;
230230
231- const resolvedValue = path . isAbsolute ( value ) ? value : path . join ( hdbRoot , value ) ;
231+ let resolvedValue ;
232+ if ( value . startsWith ( '~/' ) ) {
233+ resolvedValue = path . join ( os . homedir ( ) , value . slice ( 1 ) ) ;
234+ } else if ( path . isAbsolute ( value ) ) {
235+ resolvedValue = value ;
236+ } else {
237+ resolvedValue = path . join ( hdbRoot , value ) ;
238+ }
232239 const doesExistMsg = doesPathExist ( resolvedValue ) ;
233240 if ( doesExistMsg ) {
234241 return helpers . message ( doesExistMsg ) ;
You can’t perform that action at this time.
0 commit comments