Don't load packages starting with dot. Fixes #9805

This commit is contained in:
Katrina Uychaco 2016-04-12 20:35:30 -07:00
parent 7d13ba5d4e
commit 49fb287592
2 changed files with 5 additions and 0 deletions

View File

@ -66,6 +66,9 @@ describe "PackageManager", ->
expect(addErrorHandler.argsForCall[0][0].message).toContain("Failed to load the package-with-broken-package-json package")
expect(addErrorHandler.argsForCall[0][0].options.packageName).toEqual "package-with-broken-package-json"
it "returns null if the package name or path starts with a dot", ->
expect(atom.packages.loadPackage("/Users/user/.atom/packages/.git")).toBeNull()
it "normalizes short repository urls in package.json", ->
{metadata} = atom.packages.loadPackage("package-with-short-url-package-json")
expect(metadata.repository.type).toBe "git"

View File

@ -367,6 +367,8 @@ class PackageManager
@emitter.emit 'did-load-initial-packages'
loadPackage: (nameOrPath) ->
return null if path.basename(nameOrPath)[0].match /^\./ # primarily to skip .git folder
return pack if pack = @getLoadedPackage(nameOrPath)
if packagePath = @resolvePackagePath(nameOrPath)