fix could not send mail

This commit is contained in:
zefie
2025-08-08 23:04:34 -04:00
parent 11997228f9
commit 2f0a1eba33
3 changed files with 23 additions and 13 deletions

View File

@@ -1154,7 +1154,8 @@ class WTVShared {
* @param {string} directory Root directory
*/
getAbsolutePath(path = '', directory = '.') {
if (directory[0] == "/" || directory.slice(1, 3) == ":" + this.path.sep) {
// Check if directory is already an absolute path
if (directory.length > 0 && (directory[0] == "/" || (directory.length >= 3 && directory[1] === ':' && directory[2] === this.path.sep))) {
return this.path.resolve(directory + this.path.sep + path);
}
try {
@@ -1165,22 +1166,24 @@ class WTVShared {
return appdir;
}
// If the directory is a valid directory, prepend it to the path
directory = this.path.resolve(appdir + this.path.sep + directory);
let resolvedDirectory = this.path.resolve(appdir + this.path.sep + directory);
if (!path) {
return directory;
return resolvedDirectory;
}
if (directory && !path.startsWith(directory)) {
if (!directory.endsWith(this.path.sep)) {
directory += this.path.sep;
if (resolvedDirectory && !path.startsWith(resolvedDirectory)) {
if (!resolvedDirectory.endsWith(this.path.sep)) {
resolvedDirectory += this.path.sep;
}
path = directory + path;
path = resolvedDirectory + path;
}
// The path.resolve method will take care of normalizing slashes
return this.path.resolve(path);
} catch (e) {
// If there's an error accessing the directory, log it or handle as needed
console.error('Error resolving directory:', e);
// Fallback to basic path resolution
return this.path.resolve(path);
}
// The path.resolve method will take care of normalizing slashes
return this.path.resolve(path);
}
/**