@existdb/node-exist
Advanced tools
@@ -9,3 +9,3 @@ var mime = require('mime') | ||
| // set default values | ||
| var mimeType = options.mimetype || mime.lookup(filename) | ||
| var mimeType = options.mimetype || mime.getType(filename) | ||
| var replace = options.replace || true | ||
@@ -12,0 +12,0 @@ |
+2
-2
@@ -56,5 +56,5 @@ var mime = require('mime') | ||
| }, | ||
| getMimeTypes: function () { | ||
| return mime.types | ||
| getMimeType: function (path) { | ||
| return mime.getType(path) | ||
| } | ||
| } |
+2
-2
@@ -47,6 +47,6 @@ { | ||
| "lodash.assign": "^4.0.2", | ||
| "mime": "^1.3.4", | ||
| "mime": "^2.3.1", | ||
| "xmlrpc": "^1.3.1" | ||
| }, | ||
| "version": "1.0.3" | ||
| "version": "1.0.4" | ||
| } |
+18
-14
| // tests | ||
| var test = require('tape') | ||
| var exist = require('../../index') | ||
| var connectionOptions = require('../db-connection') | ||
| const test = require('tape') | ||
| const exist = require('../../index') | ||
| const connectionOptions = require('../db-connection') | ||
| test('check for default mime type extensions', function (t) { | ||
| var types = exist.getMimeTypes() | ||
| t.equal(types['xq'], 'application/xquery') | ||
| t.equal(types['xql'], 'application/xquery') | ||
| t.equal(types['xqm'], 'application/xquery') | ||
| t.equal(types['xconf'], 'application/xml') | ||
| t.equal(exist.getMimeType('test.xq'), 'application/xquery') | ||
| t.equal(exist.getMimeType('test.xql'), 'application/xquery') | ||
| t.equal(exist.getMimeType('test.xqm'), 'application/xquery') | ||
| t.equal(exist.getMimeType('test.xconf'), 'application/xml') | ||
| t.end() | ||
@@ -18,5 +16,11 @@ }) | ||
| test('extend mime type definitions', function (t) { | ||
| exist.defineMimeTypes({ 'text/foo': ['bar'] }) | ||
| const testPath = 'test.bar' | ||
| const testExtension = 'bar' | ||
| const testMimeType = 'text/x-test' | ||
| const testTypeMap = {} | ||
| testTypeMap[testMimeType] = [testExtension] | ||
| t.equal(exist.getMimeTypes()['bar'], 'text/foo') | ||
| t.notEqual(exist.getMimeType(testPath), testMimeType, 'previously undefined extension for ' + testExtension) | ||
| exist.defineMimeTypes(testTypeMap) | ||
| t.equal(exist.getMimeType(testPath), testMimeType, 'added new extension for ' + testExtension) | ||
| t.end() | ||
@@ -26,4 +30,4 @@ }) | ||
| test('create connection with default settings', function (t) { | ||
| var db = exist.connect() | ||
| var components = ['collections', 'queries', 'documents', 'users', 'indices'] | ||
| const db = exist.connect() | ||
| const components = ['collections', 'queries', 'documents', 'users', 'indices'] | ||
@@ -37,3 +41,3 @@ components.forEach(function (component) { | ||
| test('get collection permissions', function (t) { | ||
| var db = exist.connect(connectionOptions) | ||
| const db = exist.connect(connectionOptions) | ||
| db.resources.getPermissions('/db') | ||
@@ -40,0 +44,0 @@ .then(function (result) { |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
30235
1.24%786
0.64%+ Added
- Removed
Updated