Skip to content

Commit 5546d60

Browse files
committed
fix(info): make sure that requested username/alias matches owner
1 parent 4a5f51f commit 5546d60

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"md5": "^2.1.0",
3232
"ms-amqp-conf": "^0.2.0",
3333
"ms-amqp-transport": "^1.3.0",
34-
"ms-files-gce": "^0.6.1",
34+
"ms-files-gce": "^0.6.3",
3535
"ms-validation": "^1.0.1",
3636
"mservice": "^1.6.0",
3737
"redis-filtered-sort": "^1.1.1"

src/actions/info.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const Promise = require('bluebird');
22
const fetchData = require('../utils/fetchData.js');
33

44
const { NotImplementedError, HttpStatusError } = require('common-errors');
5-
const { FILES_DATA, FILES_OWNER_FIELD, FILES_PUBLIC_FIELD } = require('../constant.js');
5+
const { FILES_DATA, FILES_OWNER_FIELD } = require('../constant.js');
66

77
/**
88
* File information
@@ -32,8 +32,9 @@ module.exports = function getFileInfo(opts) {
3232
// ref file
3333
const info = data.file;
3434

35-
// check access permissions
36-
if (info[FILES_OWNER_FIELD] !== data.username && !info[FILES_PUBLIC_FIELD]) {
35+
// check that owner is a match
36+
// even in-case with public we want the user to specify username
37+
if (info[FILES_OWNER_FIELD] !== data.username) {
3738
throw new HttpStatusError(404, 'file not found');
3839
}
3940

0 commit comments

Comments
 (0)