diff options
author | Luca Casonato <lucacasonato@yahoo.com> | 2021-04-11 14:09:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-11 14:09:10 +0200 |
commit | e7f18d64686e2b94fe9ecba8106ca2ff5bdfe7f3 (patch) | |
tree | 4faeba935b1cd64e627b4dd7ba44e6d6b0c84be2 /op_crates/file/lib.rs | |
parent | f5a9474952f459a5095e0aae68e0984fdd84b210 (diff) |
feat: blob URL support in fetch (#10120)
This commit adds blob URL support in `fetch`. Tested via WPT. This is
the first op_crate to have a rust dependency on a different op_crate.
Diffstat (limited to 'op_crates/file/lib.rs')
-rw-r--r-- | op_crates/file/lib.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/op_crates/file/lib.rs b/op_crates/file/lib.rs index e8c2cde1d..ea519046f 100644 --- a/op_crates/file/lib.rs +++ b/op_crates/file/lib.rs @@ -24,9 +24,10 @@ pub struct Location(pub Url); pub struct BlobUrlStore(Arc<Mutex<HashMap<Url, Blob>>>); impl BlobUrlStore { - pub fn get(&self, url: &ModuleSpecifier) -> Result<Option<Blob>, AnyError> { + pub fn get(&self, mut url: Url) -> Result<Option<Blob>, AnyError> { let blob_store = self.0.lock().unwrap(); - Ok(blob_store.get(url).cloned()) + url.set_fragment(None); + Ok(blob_store.get(&url).cloned()) } pub fn insert(&self, blob: Blob, maybe_location: Option<Url>) -> Url { |