Skip to content

Commit c599a65

Browse files
committed
Limit keywords to letters, number, hyphens, and dots.
1 parent 394df96 commit c599a65

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

docs/package.md

+1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ plugin, as it's listed on the jQuery Plugins Site.
108108

109109
Put keywords in it. It's an array of strings. This helps people
110110
discover your plugin as it's listed on the jQuery Plugins Site.
111+
Keywords may only contain letters, numbers, hyphens, and dots.
111112

112113
## <a name="field-homepage">homepage</a>
113114

src/service.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,10 @@ extend( Repo.prototype, {
153153
errors.push( "Invalid data type for keywords; must be an array." );
154154
} else {
155155
package.keywords.forEach(function( keyword, i ) {
156-
// TODO: any character restrictions on keywords?
157156
if ( typeof keyword !== "string" ) {
158157
errors.push( "Invalid data type for keywords[" + i + "]; must be a string." );
158+
} else if ( !(/^[a-zA-Z0-9\.\-]+$/).test( keyword ) ) {
159+
errors.push( "Invalid characters for keyword: " + keyword + "." );
159160
}
160161
});
161162
}

0 commit comments

Comments
 (0)