Append .jpg if the original URL doesn't have an extension

This commit is contained in:
Les De Ridder 2016-05-26 01:18:32 +02:00
parent 4a06ac67f2
commit b64fffa1e7
1 changed files with 4 additions and 0 deletions

View File

@ -37,6 +37,10 @@ chrome.pageAction.onClicked.addListener(function(tab) {
var filename = betterUrl.substr(betterUrl.lastIndexOf("/")); var filename = betterUrl.substr(betterUrl.lastIndexOf("/"));
filename = cleanExtension(filename); filename = cleanExtension(filename);
if(filename.indexOf('.') == -1) {
filename = filename + '.jpg'; //on average, it's probably JPEG if it doesn't have an extension
}
chrome.storage.sync.get({url: '', tabbehaviour: '', copytoclipboard: false, replacebookmark: false, disableblacklist: false}, function(config) { chrome.storage.sync.get({url: '', tabbehaviour: '', copytoclipboard: false, replacebookmark: false, disableblacklist: false}, function(config) {
if(config.url == '') { if(config.url == '') {
alert("Please select a Pomf clone."); alert("Please select a Pomf clone.");