From c5bf4075e76ba9d0fc94fed0a849d9ff344d48e4 Mon Sep 17 00:00:00 2001 From: halo Date: Fri, 1 Jul 2022 16:47:07 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E6=88=AA=E5=8F=96?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/terminal/backends/command/serializers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/terminal/backends/command/serializers.py b/apps/terminal/backends/command/serializers.py index 4cc9827a1..15efe6113 100644 --- a/apps/terminal/backends/command/serializers.py +++ b/apps/terminal/backends/command/serializers.py @@ -2,6 +2,7 @@ from django.utils.translation import ugettext_lazy as _ from rest_framework import serializers +from common.utils import pretty_string from .models import AbstractSessionCommand __all__ = ['SessionCommandSerializer', 'InsecureCommandAlertSerializer'] @@ -46,5 +47,5 @@ class SessionCommandSerializer(SimpleSessionCommandSerializer): def validate_system_user(self, value): if len(value) > 64: - value = value[:32] + value[-32:] + value = pretty_string(value, 32) return value