Skip to content

Commit

Permalink
plugin name fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rjrodger committed Feb 16, 2019
1 parent 0277fe1 commit 13e4625
Show file tree
Hide file tree
Showing 7 changed files with 307 additions and 200 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 3.8.2

* Allow plugin names that are file paths


## 3.8.1 2019-02-10

* Fix action annotations - seneca-joi now works again
Expand Down
11 changes: 8 additions & 3 deletions lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,15 @@ exports.make_plugin_key = function(plugin, origtag) {
tag = m[2]
}

if (!name.match(/^[a-zA-Z@][a-zA-Z0-9~_\-/]*$/) || 1024 < name.length) {
throw error('bad_plugin_name', { name: name })
}
// Allow file paths, but ...
if(!name.match(/^(\.|\/|\\|\w:)/)) {

// ... anything else should be well-formed
if (!name.match(/^[a-zA-Z@][a-zA-Z0-9~_\-/]*$/) || 1024 < name.length) {
throw error('bad_plugin_name', { name: name })
}
}

if ('' != tag && (!tag.match(/^[a-zA-Z0-9~_-]+$/) || 1024 < tag.length)) {
throw error('bad_plugin_tag', { tag: tag })
}
Expand Down
Loading

0 comments on commit 13e4625

Please sign in to comment.