1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-30 08:26:59 +02:00

Tools: Trim white spaces in credential files

This commit is contained in:
Laurent Cozic 2021-06-02 21:59:53 +02:00
parent 2f79492192
commit c88e4f6628

View File

@ -28,7 +28,10 @@ export async function readCredentialFile(filename: string, defaultValue: string
try {
const filePath = await credentialFile(filename);
const r = await fs.readFile(filePath);
return r.toString();
// There's normally no reason to keep the last new line character and it
// can cause problems in certain scripts, so trim it. Any other white
// space should also not be relevant.
return r.toString().trim();
} catch (error) {
return defaultValue;
}