This repository was archived by the owner on Feb 6, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed
autoload/server/static/scripts Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change 88 mkdContainer = document . getElementById ( 'js-markdown' ) ;
99
1010 function updateTitle ( ) {
11- var fileName = Base64 . decode ( location . search . slice ( 1 ) ) . split ( '/' ) . pop ( ) ;
11+ var slash = getSlash ( ) ;
12+ var fileName = Base64 . decode ( location . search . slice ( 1 ) ) . split ( slash ) . pop ( ) ;
1213 var title = document . getElementsByTagName ( 'title' ) [ 0 ] ;
1314 title . innerHTML = fileName ;
1415 }
2324 return text ;
2425 }
2526
27+ function getSlash ( ) {
28+ var platform = navigator . platform ;
29+ var slash ;
30+ if ( / ^ w i n .* / i. test ( platform ) ) {
31+ slash = '\\' ;
32+ } else {
33+ slash = '/' ;
34+ }
35+ return slash ;
36+ }
37+
2638 function getAbsPath ( base , path ) {
27- var bases = Base64 . decode ( base . slice ( 1 ) ) . split ( '/' ) . slice ( 0 , - 1 ) ;
28- var paths = path . split ( '/' ) ;
39+ var slash = getSlash ( ) ;
40+ var bases = Base64 . decode ( base . slice ( 1 ) ) . split ( slash ) . slice ( 0 , - 1 ) ;
41+ var paths = path . split ( slash ) ;
2942 if ( / ^ h t t p s ? : ? / i. test ( paths [ 0 ] ) ) {
3043 return path ;
31- } else if ( / ^ $ / . test ( paths [ 0 ] ) ) {
44+ } else if ( / ^ | [ a - z A - Z ] : \\ . * $ / . test ( paths [ 0 ] ) ) {
3245 return '/image?' + Base64 . encode ( path ) ;
3346 } else {
3447 for ( var i = 0 , len = paths . length ; i < len ; i ++ ) {
3952 }
4053 }
4154 }
42- return '/image?' + Base64 . encode ( bases . join ( '/' ) ) ;
55+ return '/image?' + Base64 . encode ( bases . join ( slash ) ) ;
4356 }
4457
4558 options = ( function ( ) {
You can’t perform that action at this time.
0 commit comments