Skip to content

Commit

Permalink
Merge pull request #605 from dadi/develop
Browse files Browse the repository at this point in the history
v6.1.0
  • Loading branch information
annybs authored Aug 7, 2024
2 parents c3b0d04 + 2da5406 commit cd2be4d
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 19 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cache/**/*
log/**/*
coverage/
dump.rdb
package-lock.json

# Config
config.json
Expand All @@ -18,4 +19,4 @@ workspace/media/*
test/acceptance/temp-workspace
test/data.apisnapshot

scripts/coverage.svg
scripts/coverage.svg
4 changes: 2 additions & 2 deletions dadi/lib/controller/clients.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ Clients.prototype.deleteRole = async function(req, res, next) {
}
}

const {removed, results} = await model.roleRemove(req.params.clientId, [
const {removed} = await model.roleRemove(req.params.clientId, [
role
])

if (removed.length === 0) {
return help.sendBackJSON(404, res, next)(null)
}

return help.sendBackJSON(204, res, next)(null, {results})
return help.sendBackJSON(204, res, next)(null, null)
} catch (error) {
return this.handleError(res, next)(error)
}
Expand Down
10 changes: 6 additions & 4 deletions dadi/lib/storage/disk.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,18 @@ DiskStorage.prototype.get = function(filePath, route, req, res, next) {
// serve, but we're not serving files from the root. To get around this, we
// pass it a modified version of the URL, where the root URL becomes just the
// filename parameter.
const modifiedReq = Object.assign({}, req, {
url: `${route}/${req.params.filename}`
})
const origUrl = req.url

req.url = `${route}/${req.params.filename}`

return new Promise((resolve, reject) => {
try {
serveStatic(config.get('media.basePath'))(modifiedReq, res, next)
serveStatic(config.get('media.basePath'))(req, res, next)
resolve()
} catch (err) {
return reject(err)
} finally {
req.url = origUrl
}
})
}
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dadi/api",
"version": "6.0.2",
"version": "6.1.0",
"main": "main.js",
"scripts": {
"create-client": "cd ../../.. && node ./node_modules/@dadi/api/utils/create-client.js",
Expand All @@ -24,12 +24,12 @@
"@dadi/cache": "^3.0.0",
"@dadi/et": "^2.0.0",
"@dadi/format-error": "^1.7.0",
"@dadi/logger": "^1.4.1",
"@dadi/logger": "^1.5.0",
"@dadi/metadata": "^2.0.0",
"@dadi/status": "^1.0.4",
"async": "^2.6.1",
"aws-sdk": "2.249.1",
"bcrypt": "^3.0.3",
"bcrypt": "^5.1.1",
"body-parser": "^1.18.3",
"busboy": "^0.2.13",
"chokidar": "^2.0.3",
Expand Down Expand Up @@ -58,7 +58,7 @@
"recovery": "^0.2.6",
"require-directory": "^2.1.1",
"semver": "^5.5.0",
"serve-static": "^1.13.2",
"serve-static": "^1.15.0",
"sha1": "latest",
"stack-trace": "0.0.10",
"stream-cache": "0.0.2",
Expand Down Expand Up @@ -89,7 +89,7 @@
"should": "4.0.4",
"sinon": "2.3.2",
"snyk": "^1.147.3",
"supertest": "^3.1.0",
"supertest": "^7.0.0",
"uuid": "^3.3.2"
},
"dataConnectorDependencies": {
Expand Down
1 change: 1 addition & 0 deletions test/acceptance/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ describe('Cache', function(done) {
})

it('should check key exists in Redis', function(done) {

delete require.cache[__dirname + '/../../dadi/lib/']

cache.reset()
Expand Down
2 changes: 1 addition & 1 deletion test/acceptance/flush.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ describe('Cache', function(done) {
})
})

describe('Invalidation API - Redis', function() {
describe.skip('Invalidation API - Redis', function() {
before(() => {
config.set('caching.directory.enabled', false)
config.set('caching.redis.enabled', true)
Expand Down
2 changes: 1 addition & 1 deletion test/acceptance/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ describe('Media', function() {
'test/acceptance/temp-workspace/media/a girl on a bridge.jpg'
)
.end((err, res) => {
if (err) return err
if (err) return done(err)

res.body.results.length.should.eql(1)
res.body.results[0].fileName.should.eql('a_girl_on_a_bridge.jpg')
Expand Down
8 changes: 5 additions & 3 deletions test/acceptance/ssl.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ const defaultResponse = function defaultResponse(req, res, next) {
'content-length': body.length,
'content-type': 'application/json'
})
res.end('{}')
server.close()
res.end(body)
next()
}

describe('SSL', () => {
describe('SSL', function() {
this.timeout(5 * 60 * 1000)

before(done => {
// avoid [Error: self signed certificate] code: 'DEPTH_ZERO_SELF_SIGNED_CERT'
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
Expand Down
3 changes: 1 addition & 2 deletions test/mocha.opts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
--bail
--full-trace
--timeout=4000
--ui bdd
--recursive
--require=env-test
--require test/pretest.js
--exit
--exit

0 comments on commit cd2be4d

Please sign in to comment.