Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileSystemException: Creation failed. (OS Error: File name too long, errno = 63) #1344

Open
jtmuller5 opened this issue Jun 11, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@jtmuller5
Copy link

Description

I am attempting to share a private brick with another developer by including a GitHub personal access token in the git url:

bricks:
  fast_app:
    git:
      url: https://CodeOTR:github_pat_11ALOGDJY0vn1GnxTviLBe_nBcG9xOV2eUBIuPNORN........@github.com/CodeOTR/flutterfaster_bricks
      path: bricks/fast_app

Because the URL is so long, however, mason get throws an error:

FileSystemException: Creation failed, path = '/Users/josephmuller/.mason-cache/git/flutterfaster_bricks_aHR0cHM6Ly9Db2RlT1RSOmdpdGh1Yl9wYXRfMTFBTE9HREpZMHZuMUdueFR2aUxCZV9uQmNHOXhPVjJlVUJJdVBOT1JOUzNtT3dQZVVWbTBWM2k5bEdNSVVqTWhRQ1UzVVc1VjJMVnRqV1VVQUBnaXRodWIuY29tL0NvZGVPVFIvZmx1dHRlcmZhc3Rlcl9icmlja3M=_4a84d0db6d0372fd9b1c2062d43505cd35a8cdd2' (OS Error: File name too long, errno = 63)

Steps To Reproduce

  1. Create a new GitHub repo
  2. Create a PAT with the "content" permission
  3. Add a brick to the new repo
  4. In a Flutter/dart project, create a mason.yaml file and add the brick you just created by adding your username and PAT to the git url

Ex.

ricks:
  fast_app:
    git:
      url: https://<USER NAME>:<PAT>@github.com/CodeOTR/flutterfaster_bricks
      path: bricks/fast_app

Expected Behavior

This should not break. I would expect the file name to be shortened to a reasonable length. Currently it seems like a hash of the git URL.

@jtmuller5 jtmuller5 added the bug Something isn't working label Jun 11, 2024
@jtmuller5
Copy link
Author

The issue is in this function:

String _encodedGitDir(GitPath git, String commitHash) {
  final name = p.basenameWithoutExtension(git.url);
  final path = git.url.replaceAll(r'\', '/');
  final url = base64.encode(utf8.encode(path));
  return '${name}_${url}_$commitHash';
}

@felangel
Copy link
Owner

This looks like a duplicate of #496

@felangel felangel self-assigned this Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants