Skip to content

Commit f079050

Browse files
committed
Limit plugin names to letters, numbers, hyphens, dots, and underscores.
1 parent c93ddee commit f079050

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

site-content/page/names.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<p>Before you can list your plugin on this site, you'll need to choose a name for your plugin. The name is a unique identifier that distinguishes your plugin from all other plugins. This is different from the title of your plugin, which you can think of as the display name.</p>
66

7-
<p><strong>Plugin names must begin with "jquery." and may only contain URL-safe characters.</strong></p>
7+
<p><strong>Plugin names must begin with "jquery." and may only contain letters, numbers, hypens, dots, and underscores.</strong></p>
88

99
<p>We encourage you to follow a few simple tips as well:</p>
1010
<ul>

src/service.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ extend( Repo.prototype, {
5454

5555
/** required fields **/
5656

57-
// TODO: verify URL-safe characters
5857
if ( !package.name ) {
5958
errors.push( "Missing required field: name." );
6059
} else if ( typeof package.name !== "string" ) {
6160
errors.push( "Invalid data type for name; must be a string." );
61+
} else if ( !(/^[a-zA-Z0-9_\.\-]+$/).test( package.name ) ) {
62+
errors.push( "Name contained invalid characters." );
6263
} else {
6364
if ( prefix ) {
6465
if ( package.name.indexOf( prefix ) !== 0 ) {

0 commit comments

Comments
 (0)