@zachleat/fetch-links 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/links.js +12 -4
  2. package/package.json +1 -1
package/links.js CHANGED
@@ -188,15 +188,23 @@ export class Links {
188
188
  return url;
189
189
  }
190
190
 
191
+ static stripSearch(url) {
192
+ let u = new URL(url);
193
+ u.search = "";
194
+ return u.toString()
195
+ }
196
+
191
197
  static onlyKeepExternal(entry, originalUrl) {
192
198
  if(entry.type) { // keep feeds and other important types
193
199
  return true;
194
200
  }
195
201
 
196
- let comparison = originalUrl || "https://example.com";
197
- let u = this.stripProtocol((new URL(entry.url, comparison)).toString());
198
-
199
- return !u.startsWith(this.stripProtocol(comparison));
202
+ let contextUrl = originalUrl || "https://example.com";
203
+
204
+ let entryUrl = new URL(entry.url, contextUrl);
205
+ let u = this.stripProtocol(entryUrl.toString());
206
+
207
+ return !u.startsWith(this.stripProtocol(this.stripSearch(contextUrl)));
200
208
  }
201
209
 
202
210
  static onlyKeepRelevant(entry) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zachleat/fetch-links",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Utility to fetch hyperlinks from a URL.",
5
5
  "main": "links.js",
6
6
  "type": "module",