File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -55,12 +55,16 @@ def list(self) -> dict:
5555
5656 def set (self , key , value ):
5757 """set key data"""
58+ if isinstance (value , str ):
59+ value = value .strip ()
5860 return self ._db .hset (self .index , key , json .dumps (value ))
5961
6062 def setmany (self , ** mapping ):
6163 if mapping and isinstance (mapping , dict ):
6264 pipe = self ._db .pipeline ()
6365 for k , v in iteritems (mapping ):
66+ if isinstance (v , str ):
67+ v = v .strip ()
6468 pipe .hset (self .index , k , json .dumps (v ))
6569 return pipe .execute ()
6670
Original file line number Diff line number Diff line change @@ -953,7 +953,7 @@ def my():
953953 #: 基于资料本身进行的统一更新
954954 allowed_fields = ["nickname" , "avatar" , "email" ]
955955 data = {
956- k : v
956+ k : v . strip ()
957957 for k , v in iteritems (request .form .to_dict ())
958958 if k in allowed_fields
959959 }
@@ -1007,6 +1007,8 @@ def my():
10071007 try :
10081008 pipe : Pipeline = g .rc .pipeline ()
10091009 for k , v in iteritems (cfgs ):
1010+ if isinstance (v , str ):
1011+ v = v .strip ()
10101012 pipe .hset (ak , k , v )
10111013 pipe .execute ()
10121014 except RedisError :
You can’t perform that action at this time.
0 commit comments