Skip to content
This repository was archived by the owner on Nov 15, 2017. It is now read-only.

Commit 6de0dc8

Browse files
committed
this fixes #400
1 parent 21a848c commit 6de0dc8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

js/scoped-rules.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,15 +241,18 @@ function renderScopeKeyToHTML(scopeKey) {
241241

242242
/******************************************************************************/
243243

244+
// https://github.com/gorhill/httpswitchboard/issues/400
245+
// Remember to also escape brackets (IPv6)
246+
244247
function strToId(s) {
245-
return s.replace(/[ 0123456789*./:|-]/g, function(c) {
246-
return 'GHIJKLMNOPQRSTUVWXYZ'.charAt(' 0123456789*./:|-'.indexOf(c));
248+
return s.replace(/[ 0123456789*.\/:|\[\]-]/g, function(c) {
249+
return 'GHIJKLMNOPQRSTUVWXYZ'.charAt(' 0123456789*./:|-[]'.indexOf(c));
247250
});
248251
}
249252

250253
function IdToStr(id) {
251254
return id.replace(/[G-Z]/g, function(c) {
252-
return ' 0123456789*./:|-'.charAt('GHIJKLMNOPQRSTUVWXYZ'.indexOf(c));
255+
return ' 0123456789*./:|-[]'.charAt('GHIJKLMNOPQRSTUVWXYZ'.indexOf(c));
253256
});
254257
}
255258

0 commit comments

Comments
 (0)