Skip to content

Commit

Permalink
Check if the responseURL is present before checking the file extension.
Browse files Browse the repository at this point in the history
Some browsers do not provide this url (IE for ex). Relates to #125.
  • Loading branch information
ivmartel committed Mar 6, 2015
1 parent 2f8ccae commit fbe67ca
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/io/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ dwv.io.Url.prototype.load = function(ioArray)
var isGif = view.getUint32(0) === 0x47494638;

// check possible extension
if( !isJpeg && !isPng && !isGif )
// (responseURL is supported on major browsers but not IE...)
if ( !isJpeg && !isPng && !isGif && this.responseURL )
{
var ext = this.responseURL.split('.').pop().toLowerCase();
isJpeg = (ext === "jpg") || (ext === "jpeg");
Expand Down

3 comments on commit fbe67ca

@arturojain
Copy link

@arturojain arturojain commented on fbe67ca Jul 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ivmartel this commit was never merged with the master branch?

@ivmartel
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code has been re-factored since this commit, it is now in rawImageLoader.js. It does not use the responseURL property so it looks good to me.

@arturojain
Copy link

@arturojain arturojain commented on fbe67ca Jul 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ivmartel I'm trying to load a jpeg file loading from a URL and I'm still getting an error if the file is not a DICOM.

Please sign in to comment.