Resolve attachments folder before using it

This commit is contained in:
Fedor Indutny 2022-04-26 17:31:01 -07:00 committed by GitHub
parent 50100906f3
commit b7f0ec61b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 17 deletions

View file

@ -21,7 +21,13 @@ const createPathGetter =
if (!isString(userDataPath)) {
throw new TypeError("'userDataPath' must be a string");
}
return join(userDataPath, subpath);
const maybeSymlink = join(userDataPath, subpath);
if (fse.pathExistsSync(maybeSymlink)) {
return fse.realpathSync(maybeSymlink);
}
return maybeSymlink;
};
export const getAvatarsPath = createPathGetter(AVATAR_PATH);