diff --git a/core b/core index bc6a52a..3ad793a 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit bc6a52aa2bb1d81f3ddae132d10916e96fbe089d +Subproject commit 3ad793a00ae84c11a80977ce2ba2dd13d32cc19f diff --git a/extension/stats/index.js b/extension/stats/index.js index 61c6b1e..c26b1cd 100644 --- a/extension/stats/index.js +++ b/extension/stats/index.js @@ -56,7 +56,17 @@ history.forEach(({ query, content, description, time }) => { if (["https://docs.rs", "https://crates.io", "https://lib.rs"].some(prefix => content.startsWith(prefix))) { let url = new URL(content); let pathname = url.pathname.replace("/crates/", "/").slice(1); - let [crate, _] = pathname.split("/"); + let result = pathname.split("/"); + let crate; + if (result.length >= 3) { + // In this case, third element is the correct crate name. + // e.g. https://docs.rs/~/*/async_std/stream/trait.Stream.html + [_, __, crate] = result; + } else { + // In this case, the first element is the correct crate name. + // e.g. https://crates.io/crates/async_std + [crate] = result; + } crate = crate.replace(/-/gi, "_"); let counter = topCratesData[crate] || 0; topCratesData[crate] = counter + 1;