Skip to content

Commit 7cef331

Browse files
committed
netpyne-24 Fix bug about name escaping
The issue is located in the PythonControlledCapability, this code: model.replace(/"/g, '\\"').replace(/\\/g, '\\\\') escapes the \ at a bad moment, it should escape it before the " model.replace(/\\/g, '\\\\').replace(/"/g, '\\"')
1 parent 50481d6 commit 7cef331

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

webapp/Utils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ const Utils = {
155155
return modelFields;
156156
},
157157

158+
asEscapedString (value) {
159+
return value.replace(/\\/g, '\\\\').replace(/"/g, '\\"')
160+
},
161+
158162
renameKey (path, oldValue, newValue, callback) {
159163
oldValue = oldValue.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
160164
newValue = newValue.replace(/\\/g, '\\\\').replace(/"/g, '\\"');

webapp/components/general/PythonControlledCapability.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ define((require) => {
4747

4848
connectToPython (componentType, model) {
4949
const id = this.id.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
50-
model = model.replace(/"/g, '\\"').replace(/\\/g, '\\\\');
50+
model = model.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
5151
GeppettoUtils.execPythonMessage(`jupyter_geppetto.ComponentSync(componentType="${componentType}",model="${model}",id="${id}").connect()`);
5252
}
5353

0 commit comments

Comments
 (0)