Commit ada93bd Denis
committed
1 parent 69f6a5b commit ada93bd Copy full SHA for ada93bd
File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -73,10 +73,14 @@ function saveActions(from_id){
73
73
// edit in menu.file
74
74
var config = "" ;
75
75
for ( var i = 0 ; i < edit_actions [ 'add_actions' ] [ "userid" + from_id ] . actions . length ; i ++ ) {
76
- config += bot . init . DELIMETER + JSON . stringify ( edit_actions [ 'add_actions' ] [ "userid" + from_id ] . actions [ i ] ) ;
76
+ var i_action = Object . assign ( { } , edit_actions [ 'add_actions' ] [ "userid" + from_id ] . actions [ i ] ) ;
77
+ i_action . value = i_action . value . replace ( "\"" , "\\\"" ) ;
78
+ i_action . value = i_action . value . replace ( "\n" , "\\n" ) ;
79
+ config += bot . init . DELIMETER + JSON . stringify ( i_action ) ;
77
80
}
78
81
79
- var sed = "sed -i 's/\\(.*" + bot . init . DELIMETER + edit_actions [ 'add_actions' ] [ "userid" + from_id ] . catalog + bot . init . DELIMETER + edit_actions [ 'add_actions' ] [ "userid" + from_id ] . menu_item + "\\).*/\\1" + config + "/g' " + process . argv [ 2 ] ;
82
+ config = config . replace ( "'" , "\\'" ) ;
83
+ var sed = "sed -i \"\" 's/\\(.*" + bot . init . DELIMETER + edit_actions [ 'add_actions' ] [ "userid" + from_id ] . catalog + bot . init . DELIMETER + edit_actions [ 'add_actions' ] [ "userid" + from_id ] . menu_item + "\\).*/\\1" + config + "/g' " + process . argv [ 2 ] ;
80
84
bot . exec ( sed , function ( error , out , err ) {
81
85
if ( error != null )
82
86
fail ( error . toString ( ) ) ;
You can’t perform that action at this time.
0 commit comments