Skip to content

Conversation

@kovyfive
Copy link
Contributor

@kovyfive kovyfive commented Feb 25, 2018

The error can be seen on this :
http://swashbuckletest.azurewebsites.net/swagger/ui/index#/Image/Image_Put
When opened with Internet explorer, clicking the link does nothing.

Description

In internet explorer, the "Download File" button is shown as a link, but when clicked nothing happens.
Right clicking the link and selecting Save as... will ignore file name, and only display the blob name.
The file has the proper content though.

Internet explorer uses window.navigator.msSaveOrOpenBlob to save files.

Branching in this file, will allow proper functionality to the link, while having no breaking changes.

This way, the internet explorer little window in the middle of the bottom of the screen will pop up, with the proper filename.

Motivation and Context

The download link is not working in IE

Fixes #3364

How Has This Been Tested?

Built using NPM, added to WebApi project, built, opened Swagger, clicked on Download File link, and asserted the Save window appeared.

Screenshots (if appropriate):

Checklist

My PR contains...

  • No code changes (src/ is unmodified: changes to documentation, CI, metadata, etc.)
  • Dependency changes (any modification to dependencies in package.json)
  • Bug fixes (non-breaking change which fixes an issue)
  • Improvements (misc. changes to existing features)
  • Features (non-breaking change which adds functionality)

My changes...

  • are breaking changes to a public API (config options, System API, major UI change, etc).
  • are breaking changes to a private API (Redux, component props, utility functions, etc.).
  • are breaking changes to a developer API (npm script behavior changes, new dev system dependencies, etc).
  • are not breaking changes.

Documentation

  • My changes do not require a change to the project documentation.
  • My changes require a change to the project documentation.
  • If yes to above: I have updated the documentation accordingly.

Automated tests

  • My changes can not or do not need to be tested.
  • My changes can and should be tested by unit and/or integration tests.
  • If yes to above: I have added tests to cover my changes.
  • If yes to above: I have taken care to cover edge cases in my tests.
  • All new and existing tests passed.

In internet explorer, the "Download File" button is shown as a link, but when clicked nothing happens.
Right clicking the link and selecting Save as... will ignore file name, and only display the blob name.
The file has the proper content though. 

Internet explorer uses window.navigator.msSaveOrOpenBlob to save files.

Branching in this file, will allow proper functionality to the link, while having no breaking changes. 

This solves issues:
swagger-api#3364

The error can be seen on this :
http://swashbuckletest.azurewebsites.net/swagger/ui/index#/Image/Image_Put

This way, the internet explorer little window in the middle of the bottom of the screen will pop up, with the proper filename.
@heldersepu
Copy link
Contributor

IE the best browser to download a real browser

@kovyfive
Copy link
Contributor Author

Our clients uses Internet Explorer sadly, so we need to support them too.
Can you help me out why the CI failed?

@heldersepu
Copy link
Contributor

heldersepu commented Feb 25, 2018

Looks like travis is acting up:

W: The repository 'http://ppa.launchpad.net/couchdb/stable/ubuntu trusty Release' does not have a Release file.
W: Failed to fetch https://packagecloud.io/computology/apt-backport/ubuntu/dists/trusty/InRelease  Failed to connect to packagecloud.io port 443: Connection timed out
W: Failed to fetch http://ppa.launchpad.net/chris-lea/redis-server/ubuntu/dists/trusty/main/binary-amd64/Packages  Could not connect to ppa.launchpad.net:80 (91.189.95.83), connection timed out
W: Failed to fetch http://ppa.launchpad.net/chris-lea/redis-server/ubuntu/dists/trusty/main/binary-i386/Packages  Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/chris-lea/redis-server/ubuntu/dists/trusty/main/i18n/Translation-en  Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/git-core/ppa/ubuntu/dists/trusty/main/binary-amd64/Packages  Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/git-core/ppa/ubuntu/dists/trusty/main/binary-i386/Packages  Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/git-core/ppa/ubuntu/dists/trusty/main/i18n/Translation-en  Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/openjdk-r/ppa/ubuntu/dists/trusty/main/binary-amd64/Packages  Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/openjdk-r/ppa/ubuntu/dists/trusty/main/binary-i386/Packages  Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/openjdk-r/ppa/ubuntu/dists/trusty/main/i18n/Translation-en  Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/pollinate/ppa/ubuntu/dists/trusty/main/binary-amd64/Packages  Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/pollinate/ppa/ubuntu/dists/trusty/main/binary-i386/Packages  Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/pollinate/ppa/ubuntu/dists/trusty/main/i18n/Translation-en  Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/webupd8team/java/ubuntu/dists/trusty/main/binary-amd64/Packages  Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/webupd8team/java/ubuntu/dists/trusty/main/binary-i386/Packages  Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/webupd8team/java/ubuntu/dists/trusty/main/i18n/Translation-en  Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/couchdb/stable/ubuntu/dists/trusty/main/binary-amd64/Packages  Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/couchdb/stable/ubuntu/dists/trusty/main/binary-i386/Packages  Unable to connect to ppa.launchpad.net:http:
W: Some index files failed to download. They have been ignored, or old ones used instead.

Something like that happened to me, I just sent a commit to re-trigger the build in a few minutes and it completed sucessfully

Update to triggger CI
@heldersepu
Copy link
Contributor

Now you do have a valid error:

51:2 error Mixed spaces and tabs no-mixed-spaces-and-tabs

@kovyfive
Copy link
Contributor Author

All good :)

@kovyfive kovyfive closed this Feb 25, 2018
@kovyfive kovyfive reopened this Feb 25, 2018
@kovyfive
Copy link
Contributor Author

Whopsie, on the close :D

@heldersepu
Copy link
Contributor

Strange, I still see some trailing tabs ....
image
Maybe travis does not care about those?

Removed whitespaces
@kovyfive
Copy link
Contributor Author

There is no check for that it seems. Removed them.

@heldersepu
Copy link
Contributor

AwesomO

@kovyfive kovyfive changed the title Update response-body.jsx Fix "Download File" link in response-body in Internet Explorer Feb 25, 2018
}

bodyEl = <div><a href={ href } download={ download }>{ "Download file" }</a></div>
if(window.navigator.msSaveOrOpenBlob) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please refactor this to use the window wrapper instead of a direct window reference 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Imported window wrapper, and updated usage
Missing if update
Added extra check
@kovyfive
Copy link
Contributor Author

Updated!

Copy link
Contributor

@shockey shockey left a comment

Choose a reason for hiding this comment

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

LGTM

@shockey shockey merged commit 6f7a4c3 into swagger-api:master Feb 27, 2018
@shockey
Copy link
Contributor

shockey commented Feb 27, 2018

thanks, @kovyfive!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Swagger 2.0 Not Working on Internet Explorer

3 participants