Bring back upload route to keep e2e happy
let's maybe remove it in next release
This commit is contained in:
@@ -58,6 +58,7 @@ exports = module.exports = {
|
||||
clone,
|
||||
|
||||
downloadFile,
|
||||
uploadFile,
|
||||
|
||||
updateBackup,
|
||||
downloadBackup,
|
||||
@@ -929,6 +930,21 @@ async function downloadBackup(req, res, next) {
|
||||
result.stream.pipe(res);
|
||||
}
|
||||
|
||||
async function uploadFile(req, res, next) {
|
||||
assert.strictEqual(typeof req.app, 'object');
|
||||
|
||||
if (typeof req.query.file !== 'string' || !req.query.file) return next(new HttpError(400, 'file query argument must be provided'));
|
||||
if (!req.files.file) return next(new HttpError(400, 'file must be provided as multipart'));
|
||||
|
||||
req.clearTimeout();
|
||||
|
||||
const [error] = await safe(apps.uploadFile(req.app, req.files.file.path, req.query.file));
|
||||
safe.fs.unlinkSync(req.files.file.path);
|
||||
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
next(new HttpSuccess(202, {}));
|
||||
}
|
||||
|
||||
async function downloadFile(req, res, next) {
|
||||
assert.strictEqual(typeof req.app, 'object');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user