Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cloud-explorer

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cloud-explorer - npm Package Compare versions

Comparing version 2.0.9 to 2.0.10

78

lib/router.js

@@ -233,38 +233,48 @@ 'use strict';

this.post(/\/(.*)\/upload\/(.*)/, upload.array('content'), noCache, (req, res) => {
if (!req.body) Router.handleError(res, new Error('No body parsed supplied'));
//empty path get a 400 error, so avoid it
const target = {
folder: req.params[0],
path: req.params[1] || './'
if (req.body) {
//empty path get a 400 error, so avoid it
const target = {
folder: req.params[0],
path: req.params[1] || './'
}
let batchPromised = null;
if (req.files.length === 0) {
batchPromised = this.unifile.writeFile(
req.session.unifile,
target.folder,
target.path,
req.body.content
);
} else if (req.files.length === 1) {
try {
batchPromised = this.unifile.writeFile(
req.session.unifile,
target.folder,
`${target.path}/${req.files[0].originalname}`,
req.files[0].buffer
);
}
catch(err) {
// sometimes unifile throws errors, cf https://github.com/silexlabs/unifile/issues/148
batchPromised = Promise.reject(err);
}
} else {
const actions = req.files.map((file) => ({
content: file.buffer,
name: 'writeFile',
path: Path.join(target.path, file.originalname)
}));
batchPromised = this.unifile.batch(req.session.unifile, target.folder, actions);
}
batchPromised.then(() => {
res.status(EMPTY_STATUS).send();
})
.catch((err) => {
Router.handleError(res, err);
// res.status(Router.getHttpStatus(err.code)).send(err);
});
}
let batchPromised = null;
if (req.files.length === 0) {
batchPromised = this.unifile.writeFile(
req.session.unifile,
target.folder,
target.path,
req.body.content
);
} else if (req.files.length === 1) {
batchPromised = this.unifile.writeFile(
req.session.unifile,
target.folder,
`${target.path}/${req.files[0].originalname}`,
req.files[0].buffer
);
} else {
const actions = req.files.map((file) => ({
content: file.buffer,
name: 'writeFile',
path: Path.join(target.path, file.originalname)
}));
batchPromised = this.unifile.batch(req.session.unifile, target.folder, actions);
else {
Router.handleError(res, new Error('No body parsed supplied'));
}
batchPromised.then(() => {
res.status(EMPTY_STATUS).send();
})
.catch((err) => {
res.status(Router.getHttpStatus(err.code)).send(err);
});
});

@@ -271,0 +281,0 @@

{
"name": "cloud-explorer",
"version": "2.0.9",
"version": "2.0.10",
"description": "",

@@ -5,0 +5,0 @@ "main": "lib/router.js",

@@ -383,2 +383,3 @@ import Breadcrumbs from './Breadcrumbs';

<FilesDropZone
disabled={this.props.path.length === 0}
onDrop={(files) => this.upload(files)}

@@ -385,0 +386,0 @@ />

@@ -49,3 +49,3 @@ import PropTypes from 'prop-types';

<div
className="upload button"
className={`upload button${this.props.disabled ? ' disabled' : ''}`}
onClick={() => this.input.click()}

@@ -55,2 +55,3 @@ ref={(c) => (this.div = c)}

<input
disabled={this.props.disabled}
multiple

@@ -57,0 +58,0 @@ onChange={(e) => this.onDrop(e.target.files)}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc