Skip to content

Commit

Permalink
@uppy/companion: remove isobject from dependencies (transloadit#3948)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Aug 4, 2022
1 parent 26c4cad commit 1133f79
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -47,7 +47,6 @@
"grant": "4.7.0",
"helmet": "^4.6.0",
"ipaddr.js": "^2.0.1",
"isobject": "3.0.1",
"jsonwebtoken": "8.5.1",
"lodash.merge": "^4.6.2",
"mime-types": "2.1.25",
Expand Down
9 changes: 4 additions & 5 deletions src/server/Uploader.js
@@ -1,7 +1,6 @@
// eslint-disable-next-line max-classes-per-file
const tus = require('tus-js-client')
const { randomUUID } = require('node:crypto')
const isObject = require('isobject')
const validator = require('validator')
const request = require('request')
const { pipeline: pipelineCb } = require('node:stream')
Expand Down Expand Up @@ -78,17 +77,17 @@ function validateOptions (options) {
}

// validate fieldname
if (options.fieldname && typeof options.fieldname !== 'string') {
if (options.fieldname != null && typeof options.fieldname !== 'string') {
throw new ValidationError('fieldname must be a string')
}

// validate metadata
if (options.metadata != null) {
if (!isObject(options.metadata)) throw new ValidationError('metadata must be an object')
if (options.metadata != null && typeof options.metadata !== 'object') {
throw new ValidationError('metadata must be an object')
}

// validate headers
if (options.headers && !isObject(options.headers)) {
if (options.headers != null && typeof options.headers !== 'object') {
throw new ValidationError('headers must be an object')
}

Expand Down
3 changes: 1 addition & 2 deletions src/server/header-blacklist.js
@@ -1,4 +1,3 @@
const isObject = require('isobject')
const logger = require('./logger')

/**
Expand Down Expand Up @@ -50,7 +49,7 @@ const isForbiddenHeader = (header) => {
}

module.exports = (headers) => {
if (!isObject(headers)) {
if (headers == null || typeof headers !== 'object' || Array.isArray(headers)) {
return {}
}

Expand Down

0 comments on commit 1133f79

Please sign in to comment.