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

Folder hashes not identical for Windows and Unix #90

Closed
vladitasev opened this issue Mar 10, 2021 · 1 comment
Closed

Folder hashes not identical for Windows and Unix #90

vladitasev opened this issue Mar 10, 2021 · 1 comment

Comments

@vladitasev
Copy link

Hello,

Thank you for developing and maintaining this project!

There seems to be an issue with getting the same directory's hash on Windows and Unix. The individual files' hashes are identical, however the files are not ordered in the same way on Unix and Windows inside the directory (small vs caps ordering is different). Therefore one obtains a different hash for the exact same directory depending on the OS.

I checked the source code and I saw you have:

const children = files.sort()

on line 112, probably to address exactly this. However, since files is not an array of strings, but of objects, it seems that it never gets rearranged.

I think it needs to be:

const children = files.sort((a, b) => {
  if (a.name > b.name) {
    return 1;
  }
  etc...
});

Could you please look into it?

Regards,
Vladislav

@marc136
Copy link
Owner

marc136 commented Mar 13, 2021

Thanks @vladitasev, I broke this by accident with commit b2c9fc6. I will release the fix as 4.0.1

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

No branches or pull requests

2 participants