Save Pushover user key and/or API token to .env file.
()
| 19374 | return jsonify({'error': 'Invalid file path'}), 400 |
| 19375 | actual_path = resolved |
| 19376 | elif file_path.startswith('/crackedpwd'): |
| 19377 | resolved = _resolve_loot_path('/crackedpwd', 'loot/credentials', file_path) |
| 19378 | if resolved is None: |
| 19379 | return jsonify({'error': 'Invalid file path'}), 400 |
| 19380 | actual_path = resolved |
| 19381 | elif file_path.startswith('/vulnerabilities'): |
| 19382 | resolved = _resolve_loot_path('/vulnerabilities', 'output/vulnerabilities', file_path) |
| 19383 | if resolved is None: |
| 19384 | return jsonify({'error': 'Invalid file path'}), 400 |
| 19385 | actual_path = resolved |
| 19386 | elif file_path == '/logs' or file_path.startswith('/logs/'): |
| 19387 | try: |
| 19388 | actual_path = _resolve_legacy_path('/logs', os.path.join(shared_data.datadir, 'logs'), file_path) |
| 19389 | except ValueError: |
| 19390 | return jsonify({'error': 'Invalid file path'}), 400 |
| 19391 | elif file_path == '/backups' or file_path.startswith('/backups/'): |
| 19392 | try: |
| 19393 | actual_path = _resolve_legacy_path('/backups', shared_data.backupdir, file_path) |
| 19394 | except ValueError: |
| 19395 | return jsonify({'error': 'Invalid file path'}), 400 |
| 19396 | elif file_path == '/uploads' or file_path.startswith('/uploads/'): |
| 19397 | try: |
| 19398 | actual_path = _resolve_legacy_path('/uploads', shared_data.upload_dir, file_path) |
| 19399 | except ValueError: |
| 19400 | return jsonify({'error': 'Invalid file path'}), 400 |
| 19401 | else: |
| 19402 | return jsonify({'error': 'Invalid file path'}), 400 |
| 19403 | |
| 19404 | if not os.path.exists(actual_path): |
| 19405 | return jsonify({'error': 'File not found'}), 404 |
| 19406 | |
| 19407 | # Delete file or directory |
| 19408 | if os.path.isdir(actual_path): |
| 19409 | import shutil |
| 19410 | shutil.rmtree(actual_path) |
| 19411 | logger.info(f"Deleted directory: {actual_path}") |
| 19412 | else: |
| 19413 | os.remove(actual_path) |
| 19414 | logger.info(f"Deleted file: {actual_path}") |
| 19415 | |
| 19416 | return jsonify({'success': True, 'message': 'File deleted successfully'}) |
| 19417 | |
| 19418 | except Exception as e: |
| 19419 | logger.error(f"Error deleting file: {e}") |
nothing calls this directly
no test coverage detected