@@ -102,41 +102,50 @@ export function fetchMixin(proto) {
102102 } ;
103103
104104 proto . _fetch = function ( cb = noop ) {
105- const { path, query } = this . route ;
106- const qs = stringifyQuery ( query , [ 'id' ] ) ;
107- const { loadNavbar, requestHeaders, loadSidebar } = this . config ;
108- // Abort last request
109-
110- const file = this . router . getFile ( path ) ;
111- const req = request ( file + qs , true , requestHeaders ) ;
112-
113- this . isRemoteUrl = isExternal ( file ) ;
114- // Current page is html
115- this . isHTML = / \. h t m l $ / g. test ( file ) ;
116-
117- // Load main content
118- req . then (
119- ( text , opt ) =>
120- this . _renderMain (
121- text ,
122- opt ,
123- this . _loadSideAndNav ( path , qs , loadSidebar , cb )
124- ) ,
125- _ => {
126- this . _fetchFallbackPage ( path , qs , cb ) || this . _fetch404 ( file , qs , cb ) ;
127- }
128- ) ;
129-
130- // Load nav
131- loadNavbar &&
132- loadNested (
133- path ,
134- qs ,
135- loadNavbar ,
136- text => this . _renderNav ( text ) ,
137- this ,
138- true
105+ const { query } = this . route ;
106+ let { path } = this . route ;
107+
108+ // Prevent loading remote content via URL hash
109+ // Ex: https://foo.com/#//bar.com/file.md
110+ if ( isExternal ( path ) ) {
111+ history . replaceState ( null , '' , '#' ) ;
112+ this . router . normalize ( ) ;
113+ } else {
114+ const qs = stringifyQuery ( query , [ 'id' ] ) ;
115+ const { loadNavbar, requestHeaders, loadSidebar } = this . config ;
116+ // Abort last request
117+
118+ const file = this . router . getFile ( path ) ;
119+ const req = request ( file + qs , true , requestHeaders ) ;
120+
121+ this . isRemoteUrl = isExternal ( file ) ;
122+ // Current page is html
123+ this . isHTML = / \. h t m l $ / g. test ( file ) ;
124+
125+ // Load main content
126+ req . then (
127+ ( text , opt ) =>
128+ this . _renderMain (
129+ text ,
130+ opt ,
131+ this . _loadSideAndNav ( path , qs , loadSidebar , cb )
132+ ) ,
133+ _ => {
134+ this . _fetchFallbackPage ( path , qs , cb ) || this . _fetch404 ( file , qs , cb ) ;
135+ }
139136 ) ;
137+
138+ // Load nav
139+ loadNavbar &&
140+ loadNested (
141+ path ,
142+ qs ,
143+ loadNavbar ,
144+ text => this . _renderNav ( text ) ,
145+ this ,
146+ true
147+ ) ;
148+ }
140149 } ;
141150
142151 proto . _fetchCover = function ( ) {
0 commit comments