Crash if you read url with a redirect
See original GitHub issueExample:
Jimp.read('https://lk.exdom.ru/pikchers/7b/15/5f0b65287c693538212a157b.jpg', (err, pic) => {
// any code
console.log('no run');
});
CONSOLE =>
/Users/victor/dev/ws/ja/node_modules/phin/lib/phin.compiled.js:1
'use strict';var _typeof=typeof Symbol==='function'&&typeof Symbol.iterator==='symbol'?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==='function'&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj};var http=require('http');var https=require('https');var url=require('url');var qs=require('querystring');var zlib=require('zlib');var util=require('util');var phin=function phin(opts,cb){if(typeof opts!=='string'){if(!opts.hasOwnProperty('url')){throw new Error('Missing url option from options for request method.')}}var addr=(typeof opts==='undefined'?'undefined':_typeof(opts))==='object'?url.parse(opts.url):url.parse(opts);var options={'hostname':addr.hostname,'port':addr.port||(addr.protocol.toLowerCase()==='http:'?80:443),'path':addr.path,'method':'GET','headers':{},'auth':addr.auth||null,'parse':'none','stream':false};if((typeof opts==='undefined'?'undefined':_typeof(opts))==='object'){options=Object
TypeError: Cannot read property 'toLowerCase' of null
at phin (/Users/victor/dev/ws/ja/node_modules/phin/lib/phin.compiled.js:1:744)
at module.exports (/Users/victor/dev/ws/ja/node_modules/@jimp/core/dist/request.js:44:5)
at loadFromURL (/Users/victor/dev/ws/ja/node_modules/@jimp/core/dist/index.js:104:27)
at /Users/victor/dev/ws/ja/node_modules/@jimp/core/dist/index.js:111:14
at /Users/victor/dev/ws/ja/node_modules/@jimp/core/dist/request.js:48:9
at IncomingMessage.<anonymous> (/Users/victor/dev/ws/ja/node_modules/phin/lib/phin.compiled.js:1:2100)
at IncomingMessage.emit (events.js:215:7)
at endReadableNT (_stream_readable.js:1183:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:5
Top Results From Across the Web
Crash related to Redirect URL when app is published #931
In Azure portal it asks for the package name and signature hash from the user and generates the redirect URI for you. The...
Read more >Python requests module crashing when fed URL with emoji in ...
I get: raise TooManyRedirects('Exceeded {} redirects.'.format(self.max_redirects), response=resp) requests.exceptions.TooManyRedirects: Exceeded ...
Read more >Unvalidated Redirects And Forwards - Ultimate Guide
If a web application is susceptible to the URL redirection vulnerability, it accepts untrusted URL inputs that may cause it to redirect an ......
Read more >How To Redirect Old URLs To Reclaim Your Broken Links
What if you have thousands of links coming to your site...but going to a dead, 404 or broken page? Reclaim them! Here's the...
Read more >iOS app crashes when redirecting from browser to specific ...
After successful authentication, the user should get redirected to ... URL using the inAppBrowserPlugin and then he/she is redirected to an ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello @oliver-moran
Recently I came across the same issue getting the error “Cannot read property ‘toLowerCase’ of null”. Finally my debugging shows that the root cause of this issue comes from this line in the function “loadFromURL” in the file @jimp/core/dist/index.js :
options.url = response.headers.location;
Since the location may be absolute path or relative path, when it’s relative path then the new url is missing the protocol and host part, which leads to the error happened when phin uses this url and runs into function addr.protocol.toLowerCase() due to missing of protocol.
To fix this issue, we may need to add the protocol and host in front of the relative path “location” when assigning it to options.url. I fixed it temporarily on my server node this way and it works fine for redirects.
Hopefully this helps and look forward to your official fixing on this.
hey I got the solution for me it was the req.isAuthenticated() method of passport which was causing the error I removed it from my get route for image reading with gridfs and multer