Skip to content

Fix avatar file call to directory before user loaded - #576

Open
sarahentzel wants to merge 1 commit into
developfrom
FixTranscriberFileErrorOnLoad
Open

Fix avatar file call to directory before user loaded#576
sarahentzel wants to merge 1 commit into
developfrom
FixTranscriberFileErrorOnLoad

Conversation

@sarahentzel

Copy link
Copy Markdown
Collaborator

No description provided.

@sarahentzel
sarahentzel marked this pull request as ready for review September 3, 2026 14:41

@gtryus gtryus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants