mirror of https://github.com/jumpserver/jumpserver
perf: 优化截取方法
parent
04ceca1b83
commit
c5bf4075e7
|
@ -2,6 +2,7 @@
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
|
from common.utils import pretty_string
|
||||||
from .models import AbstractSessionCommand
|
from .models import AbstractSessionCommand
|
||||||
|
|
||||||
__all__ = ['SessionCommandSerializer', 'InsecureCommandAlertSerializer']
|
__all__ = ['SessionCommandSerializer', 'InsecureCommandAlertSerializer']
|
||||||
|
@ -46,5 +47,5 @@ class SessionCommandSerializer(SimpleSessionCommandSerializer):
|
||||||
|
|
||||||
def validate_system_user(self, value):
|
def validate_system_user(self, value):
|
||||||
if len(value) > 64:
|
if len(value) > 64:
|
||||||
value = value[:32] + value[-32:]
|
value = pretty_string(value, 32)
|
||||||
return value
|
return value
|
||||||
|
|
Loading…
Reference in New Issue