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

Incorrect id calculation based on path #79

Closed
NN--- opened this issue Mar 5, 2018 · 10 comments · Fixed by #81 · May be fixed by #85
Closed

Incorrect id calculation based on path #79

NN--- opened this issue Mar 5, 2018 · 10 comments · Fixed by #81 · May be fixed by #85
Labels

Comments

@NN---
Copy link
Contributor

NN--- commented Mar 5, 2018

var crx = require("crx")
console.log(new crx().generateAppId("c:\\a")) // dkofdgpiohgjhcbnlhpmdmljinhhddlj

Chrome gives you different id:
ID: igchicfaapedlfgmepccnpolhajaphik
Loaded from: C:\a

@thom4parisot
Copy link
Owner

And when you use C:\a or C:\\a ?

There are stuff happening in the internals of Chrome that don't happen in generateAppId. We can notice that have a look at the GenerateIdForPath() function in Chrome source (which internally calls MaybeNormalizePath() with some Windows specifics things).

@NN---
Copy link
Contributor Author

NN--- commented Mar 6, 2018

I’ll check it and submit PR if it solves.

@NN---
Copy link
Contributor Author

NN--- commented Mar 6, 2018

Still no go:

console.log(new crx().generateAppId("C:\\A")) // jnolanhjgfljcjnihpkbobjkjmjjcmoi
console.log(new crx().generateAppId("C:\\a")) // ifaajnbbnkmlgkcoakicakcbihceknij

@thom4parisot
Copy link
Owner

thom4parisot commented Mar 6, 2018

Hm, it's weird.

I can reproduce the same extension ID with crx, the command line and when loading an unpacked Chrome extension in Chrome directly. But on Linux. There seem to be a different behaviour somewhere on Windows.

EDIT: I have asked for help on Twitter. I tried in a Windows VM but could not reproduce the value generated by Chrome. Whereas I can on Linux and macOS.

@thom4parisot
Copy link
Owner

@NN--- if you install crx via GitHub (npm i github:oncletom/crx) and try out the examples above, let me know if that works for you.

I'd be tempted to separate the methods, and have generateIdFromPath and generateId (with a Buffer) before releasing a new version of crx.

@NN---
Copy link
Contributor Author

NN--- commented Mar 13, 2018

It works !

@IgnusG
Copy link

IgnusG commented Jan 11, 2019

@oncletom Is there a reason there are no further releases on npm?

@thom4parisot
Copy link
Owner

@IgnusG it's not intentional, mostly a lack of headspace to wrap my head around what was required to release a new version. I think I felt ambiguous releasing a major version just to bump some dependencies and the minimum Node version requirement.

Time has passed and I'm fine with it now. I'll take some time this week to wrap things up and release a new version. Thanks for raising this issue 👍

@IgnusG
Copy link

IgnusG commented Jan 13, 2019

@oncletom no problem at all, the github version works perfectly, was just wondering ;)
Thanks for your work

@thom4parisot
Copy link
Owner

thom4parisot commented Jan 13, 2019

Yeah, me too I'm wondering!

Fetching a git dependency is slower than an npm module so I'm quite happy if that's easier to track.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants