Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: issue about invalid 'data:' and 'blob:' links #60

Merged
merged 3 commits into from
Oct 31, 2024
Merged
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
13 changes: 9 additions & 4 deletions dist/drill.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! drill.js - v5.3.11 https://github.com/kirakiray/drill.js (c) 2018-2024 YAO
//! drill.js - v5.3.12 https://github.com/kirakiray/drill.js (c) 2018-2024 YAO
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
Expand Down Expand Up @@ -139,11 +139,16 @@
}
}

const getNotHttp = (url) => /^blob:/.test(url) || /^data:/.test(url);

const caches = new Map();
const wrapFetch = async (url, params) => {
const d = new URL(url);
let reUrl = url;

const reUrl = params.includes("-direct") ? url : `${d.origin}${d.pathname}`;
if (!getNotHttp(url)) {
const d = new URL(url);
reUrl = params.includes("-direct") ? url : `${d.origin}${d.pathname}`;
}

let fetchObj = caches.get(reUrl);

Expand Down Expand Up @@ -185,7 +190,7 @@
const { url, params } = ctx;
const d = new URL(url);

const notHttp = /^blob:/.test(url) || /^data:/.test(url);
const notHttp = getNotHttp(url);
try {
if (notHttp || params.includes("-direct")) {
ctx.result = await import(url);
Expand Down
4 changes: 2 additions & 2 deletions dist/drill.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/drill.min.js.map

Large diffs are not rendered by default.

Loading
Loading