add put /:name/:tag, close #332 #333

Merged
merged 2 commits into from Apr 18, 2014

Projects

None yet

2 participants

@dead-horse
Member

No description provided.

@fengmk2 fengmk2 was assigned by dead-horse Apr 18, 2014
@dead-horse dead-horse added this to the v0.4 milestone Apr 18, 2014
@fengmk2 fengmk2 commented on an outdated diff Apr 18, 2014
controllers/registry/module.js
@@ -938,3 +939,47 @@ exports.listAllModuleNames = function *() {
return m.name;
});
};
+
+exports.updateTag = function *() {
+ var version = this.request.body;
+ var tag = this.params.tag;
+ var name =this.params.name;
@fengmk2 fengmk2 commented on the diff Apr 18, 2014
controllers/registry/module.js
+ }
+
+ if (!semver.valid(version)) {
+ this.status = 403;
+ var reason = util.format('setting tag %s to invalid version: %s: %s/%s',
+ tag, version, name, tag);
+ this.body = {
+ error: 'forbidden',
+ reason: reason
+ };
+ return;
+ }
+
+ var mod = yield Module.get(name, version);
+ if (!mod) {
+ this.status = 403;
@fengmk2
fengmk2 Apr 18, 2014 Member

this should be 404

@dead-horse
dead-horse Apr 18, 2014 Member

npm return 403..

@fengmk2
fengmk2 Apr 18, 2014 Member

...... got it

@fengmk2
Member
fengmk2 commented Apr 18, 2014

LGTM

@fengmk2 fengmk2 merged commit 6aae538 into master Apr 18, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
@fengmk2 fengmk2 deleted the issue332-tag branch Apr 18, 2014
@fengmk2 fengmk2 added the enhancement label Apr 18, 2014
@fengmk2
Member
fengmk2 commented Apr 18, 2014

厄, 用户权限校验呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment