camsong / chrome-github-mate

Chrome extension to make single file download effortless and with more features
https://chrome.google.com/webstore/detail/github-mate/baggcehellihkglakjnmnhpnjmkbmpkf
MIT License
360 stars 63 forks source link

Download button just puts raw view- exact same as hitting raw button. #41

Closed GameMaster719 closed 5 years ago

GameMaster719 commented 6 years ago

Hit the download button on a file, and its the exact same result as hitting the raw button and getting a web view of the file, and don't download anything..

Snopoff commented 6 years ago

Hey, I've got the same problem trying to download ipynb file. Have you found any solution? I also can download a file via an icon of one.

BobbyTalvin commented 5 years ago

I had checked the chrome console and it error log message maybe show some clue:

Refused to load the image 'data:image/png;base64,xxxxxx' because it violates the following Content Security Policy directive: "default-src 'none'". Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback.

jainayush007 commented 5 years ago

Same problem for me too. The download option just downloads the raw file.Any solutions?

camsong commented 5 years ago

This is because the <a> download attribute does not support cross origin download, according to: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#Attributes

This attribute only works for same-origin URLs.

When you clock 'download' button, GitHub will redirect you to https://raw.githubusercontent.com/xxx, will violate the same-origin policy. Right now, this is no work around ☹