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

feat: check asar existence and integrity #401

Merged
merged 1 commit into from
May 18, 2016

Conversation

demetris-manikas
Copy link
Contributor

No description provided.

@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @develar and @bontibon to be potential reviewers

@demetris-manikas
Copy link
Contributor Author

Forgot to mention that this patch was created in response to #371.
Doesn't solve the problem but throws more descriptive errors.

@develar
Copy link
Member

develar commented May 17, 2016

If we want to report more clear message if asar file doesn't exists, maybe we should fix code

try {
        return statFile(path.join(resourcesDir, "app.asar"), relativeFile) != null
      }
      catch (e) {
        // asar throws error on access to undefined object (info.link)
        return false
      }

? Here we just ignore error and returns false. I think, it is possible to throw error throw new Error(Package file ${asarFile} was not created.) here (checking error) and avoid yet another check.

listPackage(asarFile)
}
catch (e) {
throw new Error(`Package file ${asarFile} is corrupted.`)
Copy link
Member

Choose a reason for hiding this comment

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

Is it real case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#371 suggests that it is real. Haven't been able to reproduce.

@demetris-manikas
Copy link
Contributor Author

Why not. It just feels more natural to me to first check for existence and then try to act on a file than trying to act on a file and on error check for its existence.

@develar
Copy link
Member

develar commented May 18, 2016

Makes sense since #397 I feel that there is area to optimise, but... let's do it later.

@develar develar merged commit 4a9af55 into electron-userland:master May 18, 2016
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.

3 participants