plsgivemeachane commited on
Commit
23066a8
·
1 Parent(s): 78d9cf0

Upload API2

Browse files
Files changed (1) hide show
  1. index.js +4 -0
index.js CHANGED
@@ -418,6 +418,10 @@ app.post('/file/upload', upload.single('file'), async (req, res) => {
418
  const full_file_path = req.user.username + (file_path ? ("/" + file_path) : "");
419
 
420
  try {
 
 
 
 
421
  // Upload the file to another backend
422
  const random_client = Math.floor(Math.random() * current_connections.length);
423
  const client = current_connections[random_client];
 
418
  const full_file_path = req.user.username + (file_path ? ("/" + file_path) : "");
419
 
420
  try {
421
+
422
+ if(current_connections.length == 0) {
423
+ res.sendStatus(500);
424
+ }
425
  // Upload the file to another backend
426
  const random_client = Math.floor(Math.random() * current_connections.length);
427
  const client = current_connections[random_client];