Skip to content

Commit d6dc4fe

Browse files
committed
open-in-swan: workaround
1 parent 01e8289 commit d6dc4fe

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

open-in-swan/src/index.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@ const appInfo = {
88
{
99
extension: 'ipynb',
1010
handler: (info) => {
11-
window.open(
12-
'https://cern.ch/swanserver/cgi-bin/go?projurl=file:/' + info.filePath,
13-
'_blank'
14-
)
11+
if (info.filePath.startsWith('/files')) {
12+
let path = info.filePath.split('/')
13+
path.splice(0, 3)
14+
path = path.join('/')
15+
window.open('https://cern.ch/swanserver/cgi-bin/go?projurl=file://' + path, '_blank')
16+
} else {
17+
// FIXME
18+
alert('Cannot open this file in SWAN')
19+
}
1520
},
1621
canBeDefault: false
1722
}

0 commit comments

Comments
 (0)