pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/docsifyjs/docsify/pull/1660/files

" href="https://github.githubassets.com/assets/github-cf976967feea1e66.css" /> fix: files from basePath should be remoteUrl:false by b6pzeusbc54tvhw5jgpyw8pwz2x6gs · Pull Request #1660 · docsifyjs/docsify · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/core/fetch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,13 @@ export function fetchMixin(proto) {
};

proto._fetch = function(cb = noop) {
const { basePath } = this.config;
const { query } = this.route;
let { path } = this.route;

// Prevent loading remote content via URL hash
// Ex: https://foo.com/#//bar.com/file.md
if (isExternal(path)) {
if (isExternal(path, basePath)) {
history.replaceState(null, '', '#');
this.router.normalize();
} else {
Expand All @@ -92,7 +93,7 @@ export function fetchMixin(proto) {
const file = this.router.getFile(path);
const req = request(file + qs, true, requestHeaders);

this.isRemoteUrl = isExternal(file);
this.isRemoteUrl = isExternal(file, basePath);
// Current page is html
this.isHTML = /\.html$/g.test(file);

Expand Down
18 changes: 14 additions & 4 deletions src/core/util/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,20 @@ export function isFn(obj) {
* @param {String} string url
* @returns {Boolean} True if the passed-in url is external
*/
export function isExternal(url) {
let match = url.match(
/^([^:/?#]+:)?(?:\/{2,}([^/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/
);
export function isExternal(url, basePath) {
const regExp = /^([^:/?#]+:)?(?:\/{2,}([^/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/;
let match = url.match(regExp);

if (basePath) {
const matchWithBasePath = basePath.match(regExp);
if (
match && matchWithBasePath &&
match[1] === matchWithBasePath[1] &&
match[2] === matchWithBasePath[2]
) {
return false;
}
}

if (
typeof match[1] === 'string' &&
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy