Browse files

subdirs work

  • Loading branch information...
1 parent bc50454 commit 31b77eb55b9e01e9e419cbc8d903b0df1dc4a1b5 @substack committed Sep 22, 2012
Showing with 12 additions and 5 deletions.
  1. +4 −0 README.markdown
  2. +6 −3 lib/handle.js
  3. +1 −1 package.json
  4. +1 −1 test/subdir.js
View
4 README.markdown
@@ -102,6 +102,10 @@ Create a new bare repository `repoName` in the instance repository directory.
Optionally get a callback `cb(err)` to be notified when the repository was
created.
+## repos.mkdir(dir, cb)
+
+Create a subdirectory `dir` in the repo dir with an errback `cb(err)`.
+
## repos.list(cb)
Get a list of all the repositories in the callback `cb(err, repos)`.
View
9 lib/handle.js
@@ -24,8 +24,9 @@ handlers.push(function (req, res) {
if (req.method !== 'GET') return false;
var u = url.parse(req.url);
- var m = u.pathname.match(/\/([^\/]+)\/info\/refs$/);
+ var m = u.pathname.match(/\/(.+)\/info\/refs$/);
if (!m) return false;
+ if (/\.\./.test(m[1])) return false;
var self = this;
@@ -54,8 +55,9 @@ handlers.push(function (req, res) {
handlers.push(function (req, res) {
if (req.method !== 'GET') return false;
- var m = u.pathname.match(/^\/([^\/]+)\/HEAD$/);
+ var m = u.pathname.match(/^\/(.+)\/HEAD$/);
if (!m) return false;
+ if (/\.\./.test(m[1])) return false;
var self = this;
var repo = m[1];
@@ -108,8 +110,9 @@ handlers.push(function (req, res) {
handlers.push(function (req, res) {
if (req.method !== 'POST') return false;
- var m = req.url.match(/\/([^\/]+)\/git-(.+)/);
+ var m = req.url.match(/\/(.+)\/git-(.+)/);
if (!m) return false;
+ if (/\.\./.test(m[1])) return false;
var self = this;
var repo = m[1], service = m[2];
View
2 package.json
@@ -1,7 +1,7 @@
{
"name" : "pushover",
"description" : "git push deploy server over http",
- "version" : "1.0.0",
+ "version" : "1.0.1",
"repository" : {
"type" : "git",
"url" : "git://github.com/substack/pushover.git"
View
2 test/subdir.js
@@ -81,7 +81,7 @@ test('create, push to, and clone a repo', function (t) {
;
repos.on('push', function (push) {
- t.equal(push.repo, 'doom', 'repo name');
+ t.equal(push.repo, 'xyz/doom', 'repo name');
t.equal(push.commit, lastCommit, 'commit ok');
t.equal(push.branch, 'master', 'master branch');

0 comments on commit 31b77eb

Please sign in to comment.