File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,9 +34,11 @@ type LoadSaltFileOutput = { success: true; data: string; message?: string } | {
3434export function loadSaltFile ( { saltFilePath, validatorRegexp = DEFAULT_VALIDATOR_REGEXP } : LoadSaltFileInput ) : LoadSaltFileOutput {
3535
3636 // TODO: potentially clean up line endings and whitespace here
37- const saltData = attemptToReadFileData ( saltFilePath , SALT_FILE_ENCODING ) ;
38- if ( ! saltData ) return { success : false , message : `[ERROR] Unable to read salt file at path: ${ saltFilePath } ` } ;
39-
37+ const buf = attemptToReadFileData ( saltFilePath , SALT_FILE_ENCODING ) ;
38+ if ( ! buf ) return { success : false , message : `[ERROR] Unable to read salt file at path: ${ saltFilePath } ` } ;
39+
40+ const saltData = buf . toString ( ) . replace ( / \r \n / g, "\n" ) ;
41+
4042 // check if the structure is correct for the file
4143 const CHECK_RX = new RegExp ( validatorRegexp ) ;
4244 if ( ! CHECK_RX . test ( saltData ) ) {
You can’t perform that action at this time.
0 commit comments