Skip to content

Commit 50481d6

Browse files
committed
netpyne-24 Update pattern for special char masking
1 parent b75493d commit 50481d6

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

webapp/Utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ const Utils = {
156156
},
157157

158158
renameKey (path, oldValue, newValue, callback) {
159-
oldValue = oldValue.replace(/"/g, '\\"');
160-
newValue = newValue.replace(/"/g, '\\"');
159+
oldValue = oldValue.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
160+
newValue = newValue.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
161161
this.execPythonMessage(`netpyne_geppetto.rename("${path}","${oldValue}","${newValue}")`)
162162
.then((response) => {
163163
callback(response, newValue);

webapp/components/general/PythonControlledCapability.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ define((require) => {
4646
}
4747

4848
connectToPython (componentType, model) {
49-
const id = this.id.replace(/"/g, '\\"');
50-
model = model.replace(/"/g, '\\"');
49+
const id = this.id.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

5454
disconnectFromPython () {
55-
const id = this.id.replace(/"/g, '\\"');
55+
const id = this.id.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
5656
GeppettoUtils.execPythonMessage(`jupyter_geppetto.remove_component_sync(componentType="${this.state.componentType}",model="${id}")`);
5757
GEPPETTO.ComponentFactory.removeExistingComponent(this.state.componentType, this);
5858
}

0 commit comments

Comments
 (0)