Fix avatar file call to directory before user loaded - #576
Open
sarahentzel wants to merge 1 commit into
Open
Conversation
sarahentzel
marked this pull request as ready for review
September 3, 2026 14:41
gtryus
requested changes
Sep 3, 2026
Contributor
There was a problem hiding this comment.
This works only because by convention people don't name folders with a period in the name. In fact you can name a folder with a period in the name and a better approach would be to use something like this logic in ipcMethods to create an isDirectory method:
const fs = require('fs');
const path = require('path');
function checkPathType(filePath) {
try {
// Use lstat to inspect the path itself (does not follow symlinks)
const stats = fs.lstatSync(filePath);
if (stats.isSymbolicLink()) {
// It is a symlink; resolve it to check the target
const targetPath = fs.realpathSync(filePath);
const targetStats = fs.statSync(targetPath); // stat follows the link
return { isSymlink: true, isDirectory: targetStats.isDirectory() };
} else {
// It is a direct path (file or directory)
return { isSymlink: false, isDirectory: stats.isDirectory() };
}
} catch (error) {
return { error: error.message };
}
}
// Usage
console.log(checkPathType('./my-path')); (I am assuming we can handle symbolic links to avatar files? but if we don't the logic is even simpler.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.