mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Check for invalid package names early in the codepath.
We already don't work with packages that contain '.' in the name, this just moves the error up and makes it clearer.
This commit is contained in:
@@ -175,6 +175,17 @@ _.extend(Library.prototype, {
|
||||
return self.loadedPackages[name].pkg;
|
||||
}
|
||||
|
||||
// Check for invalid package names.
|
||||
//
|
||||
// XXX should we be even stricter and whitelist something like
|
||||
// /\-_A-Za-z0-9/ instead of blacklisting some special characters?
|
||||
// What about unicode package names?
|
||||
if (/[\.\?|'"#<>\(\)]/.test(name)) {
|
||||
if (throwOnError === false)
|
||||
return null;
|
||||
throw new Error("Invalid package name: " + name);
|
||||
}
|
||||
|
||||
var packageDir = self.findPackageDirectory(name);
|
||||
|
||||
if (! packageDir) {
|
||||
|
||||
Reference in New Issue
Block a user