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

Single file download don‘t work #40

Closed charles9056 closed 5 years ago

charles9056 commented 6 years ago

the button 'click to download' is disappeared.

duianto commented 6 years ago

The Download button is visible when viewing a single file, ex: https://github.com/camsong/chrome-github-mate/blob/master/README.md

chrome_2018-09-18_13-48-20

But when the Download button is clicked, then it works the same way as the default Raw button, which opens the file as text: https://raw.githubusercontent.com/camsong/chrome-github-mate/master/README.md

The file doesn't start downloading as one would expect.

P.S. Just noticed that the Download/Raw button issue already had been reported here: Download button just puts raw view exact same as hitting raw button. #41

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 ☹

same with https://github.com/camsong/chrome-github-mate/issues/41