New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

deshortify

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deshortify - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

26

dist/deshortify.js

@@ -124,2 +124,8 @@ 'use strict';

var newUrl = resolveUrl(url, res.headers.location);
if (this$1._rollbackUrl(newUrl)) {
if (this$1._verbose) {
console.log("rolling back: ", url, " ← ", newUrl);
}
return resolve(this$1._cleanUp(url));
}
if (this$1._verbose && url !== newUrl) {

@@ -263,6 +269,22 @@ console.log("follow: ", url, " → ", newUrl);

host.match(/\.nytimes\.com$/) || // Infinite nocookies loop
host.match(/^www\.amazon\.$/) || // 405 MethodNotAllowed
host.match(/^www\.amazon\.$/) // 405 MethodNotAllowed
);
};
// Returns boolean true if the URL should be rolled back to the previous one,
// false otherwise.
// The goal is to avoid displaying URLs with obvious signs of being GPDR or
// "no cookies" interstitials.
Deshortifier.prototype._rollbackUrl = function _rollbackUrl (url) {
var parsedUrl = parseUrl(url, true);
var host = parsedUrl.host;
var pathname = parsedUrl.pathname;
return (
url.match(/\/authorize/) || // Potential paywall (e.g. nature.com)
url.match(/subscribe/) || // Potential paywall
url.match(/nocookie/) || // Potential paywall/login
url.match(/gdpr/) // Potential "GDPR consent" interstitial
url.match(/gdpr/) || // Potential "GDPR consent" interstitial
(host === "www.bloomberg.com" && pathname.match(/^\/tosv2.html/)) // GPDR interstitial
);

@@ -269,0 +291,0 @@ };

2

package.json
{
"name": "deshortify",
"version": "0.5.0",
"version": "0.6.0",
"description": "Turns short URLs into long, meaningful, crap-less URLs.",

@@ -5,0 +5,0 @@ "main": "dist/deshortify.js",

@@ -119,2 +119,8 @@ const http = require("http");

let newUrl = resolveUrl(url, res.headers.location);
if (this._rollbackUrl(newUrl)) {
if (this._verbose) {
console.log("rolling back: ", url, " ← ", newUrl);
}
return resolve(this._cleanUp(url));
}
if (this._verbose && url !== newUrl) {

@@ -239,3 +245,3 @@ console.log("follow: ", url, " → ", newUrl);

let host = parsedUrl.host;
let { host } = parsedUrl;

@@ -259,8 +265,23 @@ return (

host.match(/\.nytimes\.com$/) || // Infinite nocookies loop
host.match(/^www\.amazon\.$/) || // 405 MethodNotAllowed
host.match(/^www\.amazon\.$/) // 405 MethodNotAllowed
);
}
// Returns boolean true if the URL should be rolled back to the previous one,
// false otherwise.
// The goal is to avoid displaying URLs with obvious signs of being GPDR or
// "no cookies" interstitials.
_rollbackUrl(url) {
let parsedUrl = parseUrl(url, true);
let { host, pathname } = parsedUrl;
return (
url.match(/\/authorize/) || // Potential paywall (e.g. nature.com)
url.match(/subscribe/) || // Potential paywall
url.match(/nocookie/) || // Potential paywall/login
url.match(/gdpr/) // Potential "GDPR consent" interstitial
url.match(/gdpr/) || // Potential "GDPR consent" interstitial
(host === "www.bloomberg.com" && pathname.match(/^\/tosv2.html/)) // GPDR interstitial
);
}
}

@@ -23,5 +23,9 @@

deshortifier.deshortify('https://www.linkedin.com/slink?code=dCDEzrN');
// deshortifier.deshortify('https://www.linkedin.com/slink?code=dCDEzrN');
// Should be rolled back
// deshortifier.deshortify('https://www.bloomberg.com/news/articles/2019-06-10/salesforce-to-buy-tableau-for-15-3-billion-in-all-stock-deal');
deshortifier.deshortify('https://www.nature.com/articles/s41598-019-44557-w');

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc