workaround for malforrmed url
This commit is contained in:
parent
c9affeac58
commit
a3f3c4b041
15
README.md
15
README.md
|
@ -1,18 +1,3 @@
|
||||||
<!-- BANNER_TPL_BEGIN -->
|
|
||||||
|
|
||||||
About Daplie: We're taking back the Internet!
|
|
||||||
--------------
|
|
||||||
|
|
||||||
Down with Google, Apple, and Facebook!
|
|
||||||
|
|
||||||
We're re-decentralizing the web and making it read-write again - one home cloud system at a time.
|
|
||||||
|
|
||||||
Tired of serving the Empire? Come join the Rebel Alliance:
|
|
||||||
|
|
||||||
<a href="mailto:jobs@daplie.com">jobs@daplie.com</a> | [Invest in Daplie on Wefunder](https://daplie.com/invest/) | [Pre-order Cloud](https://daplie.com/preorder/), The World's First Home Server for Everyone
|
|
||||||
|
|
||||||
<!-- BANNER_TPL_END -->
|
|
||||||
|
|
||||||
# redirect-https
|
# redirect-https
|
||||||
|
|
||||||
Redirect from HTTP to HTTPS using meta redirects
|
Redirect from HTTP to HTTPS using meta redirects
|
||||||
|
|
8
index.js
8
index.js
|
@ -35,8 +35,14 @@ module.exports = function (opts) {
|
||||||
;
|
;
|
||||||
//var encodedLocation = encodeURI(newLocation);
|
//var encodedLocation = encodeURI(newLocation);
|
||||||
var escapedLocation = escapeHtml(newLocation);
|
var escapedLocation = escapeHtml(newLocation);
|
||||||
|
var encodedLocation;
|
||||||
|
try {
|
||||||
|
encodedLocation = decodeURIComponent(newLocation);
|
||||||
|
} catch(e) {
|
||||||
|
encodedLocation = "#/error/?error_message=" + e.toString();
|
||||||
|
}
|
||||||
var body = opts.body
|
var body = opts.body
|
||||||
.replace(/{{\s*HTML_URL\s*}}/ig, escapeHtml(decodeURIComponent(newLocation)))
|
.replace(/{{\s*HTML_URL\s*}}/ig, escapeHtml(encodedLocation))
|
||||||
.replace(/{{\s*URL\s*}}/ig, escapedLocation)
|
.replace(/{{\s*URL\s*}}/ig, escapedLocation)
|
||||||
.replace(/{{\s*UNSAFE_URL\s*}}/ig, newLocation)
|
.replace(/{{\s*UNSAFE_URL\s*}}/ig, newLocation)
|
||||||
;
|
;
|
||||||
|
|
10
package.json
10
package.json
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "redirect-https",
|
"name": "redirect-https",
|
||||||
"version": "1.1.1",
|
"version": "1.1.2",
|
||||||
"description": "Redirect from HTTP to HTTPS using meta redirects",
|
"description": "Redirect from HTTP to HTTPS using meta redirects",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/Daplie/node-redirect-https.git"
|
"url": "git+https://git.coolaj86.com/coolaj86/redirect-https.js.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"https",
|
"https",
|
||||||
|
@ -22,10 +22,10 @@
|
||||||
"author": "AJ ONeal <coolaj86@gmail.com> (http://coolaj86.com/)",
|
"author": "AJ ONeal <coolaj86@gmail.com> (http://coolaj86.com/)",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/Daplie/node-redirect-https/issues"
|
"url": "https://git.coolaj86.com/coolaj86/redirect-https.js/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/Daplie/node-redirect-https#readme",
|
"homepage": "https://git.coolaj86.com/coolaj86/redirect-https.js#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"escape-html": "^1.0.2"
|
"escape-html": "^1.0.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue