diff --git a/apps/accounts/automations/gather_account/filter.py b/apps/accounts/automations/gather_account/filter.py index bb10cb463..f6a5b5a1d 100644 --- a/apps/accounts/automations/gather_account/filter.py +++ b/apps/accounts/automations/gather_account/filter.py @@ -40,6 +40,8 @@ def parse_int(value, default=None): if not text or text.lower() in {"none", "null"}: return default if text.startswith(("b'", 'b"')): + if len(text) > 1024: + return default try: maybe_bytes = literal_eval(text) if isinstance(maybe_bytes, (bytes, bytearray)): diff --git a/apps/jumpserver/views/other.py b/apps/jumpserver/views/other.py index e4dab34c5..c6617eaa9 100644 --- a/apps/jumpserver/views/other.py +++ b/apps/jumpserver/views/other.py @@ -7,20 +7,17 @@ from urllib.parse import urlparse from django.conf import settings from django.http import HttpResponse from django.http import HttpResponseBadRequest -from django.http import HttpResponseRedirect, JsonResponse, Http404 +from django.http import HttpResponseRedirect, JsonResponse from django.shortcuts import redirect from django.utils import timezone from django.utils.translation import gettext_lazy as _ -from django.views.decorators.csrf import csrf_exempt from django.views.generic import View, TemplateView from rest_framework.views import APIView from common.utils import lazyproperty -from common.views.http import HttpResponseTemporaryRedirect __all__ = [ - 'LunaView', 'I18NView', 'KokoView', 'WsView', - 'redirect_format_api', 'redirect_old_apps_view', 'UIView', + 'LunaView', 'I18NView', 'KokoView', 'WsView', 'UIView', 'ResourceDownload', 'RedirectConfirm' ] @@ -48,30 +45,6 @@ class I18NView(View): api_url_pattern = re.compile(r'^/api/(?P\w+)/(?Pv\d)/(?P.*)$') -@csrf_exempt -def redirect_format_api(request, *args, **kwargs): - _path, query = request.path, request.GET.urlencode() - matched = api_url_pattern.match(_path) - if matched: - kwargs = matched.groupdict() - kwargs["query"] = query - _path = '/api/{version}/{app}/{extra}?{query}'.format(**kwargs).rstrip("?") - return HttpResponseTemporaryRedirect(_path) - else: - return JsonResponse({"msg": "Redirect url failed: {}".format(_path)}, status=404) - - -@csrf_exempt -def redirect_old_apps_view(request, *args, **kwargs): - path = request.get_full_path() - if path.find('/core') != -1: - raise Http404() - if path in ['/docs/', '/docs', '/core/docs/', '/core/docs']: - return redirect('/api/docs/') - new_path = '/core{}'.format(path) - return HttpResponseTemporaryRedirect(new_path) - - class WsView(APIView): ws_port = settings.HTTP_LISTEN_PORT + 1 diff --git a/apps/terminal/applets/dbeaver/app.py b/apps/terminal/applets/dbeaver/app.py index 0429bad73..e8b789e2f 100644 --- a/apps/terminal/applets/dbeaver/app.py +++ b/apps/terminal/applets/dbeaver/app.py @@ -53,7 +53,7 @@ class AppletApplication(BaseApplication): @staticmethod def _write_config(config_file, config): - with open(config_file, 'w')as f: + with open(config_file, 'w') as f: for key, value in config.items(): f.write(f'{key}={value}\n')