issue 96 New styles have a URL of undefined
This commit is contained in:
parent
cfa80ee785
commit
b7aa8b4b81
|
@ -198,12 +198,12 @@ function saveStyle(o, callback) {
|
|||
}
|
||||
} else {
|
||||
// create a new record
|
||||
if (!("updateUrl" in o)) {
|
||||
o.updateUrl = null;
|
||||
}
|
||||
if (!("md5Url" in o)) {
|
||||
o.md5Url = null;
|
||||
}
|
||||
// set optional things to null if they're undefined
|
||||
["updateUrl", "md5Url", "url"].filter(function(att) {
|
||||
return !(att in o);
|
||||
}).forEach(function(att) {
|
||||
o[att] = null;
|
||||
});
|
||||
t.executeSql('INSERT INTO styles (name, enabled, url, updateUrl, md5Url) VALUES (?, ?, ?, ?, ?);', [o.name, true, o.url, o.updateUrl, o.md5Url]);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@ function getDatabase(ready, error) {
|
|||
dbV12(stylishDb, error, ready);
|
||||
} else if (stylishDb.version == "1.2") {
|
||||
dbV13(stylishDb, error, ready);
|
||||
} else if (stylishDb.version == "1.3") {
|
||||
dbV14(stylishDb, error, ready);
|
||||
} else {
|
||||
ready(stylishDb);
|
||||
}
|
||||
|
@ -51,6 +53,12 @@ function dbV13(d, error, done) {
|
|||
}, error, function() { done(d)});
|
||||
}
|
||||
|
||||
function dbV14(d, error, done) {
|
||||
d.changeVersion(d.version, '1.4', function (t) {
|
||||
t.executeSql('UPDATE styles SET url = null WHERE url = "undefined";');
|
||||
}, error, function() { done(d)});
|
||||
}
|
||||
|
||||
function enableStyle(id, enabled) {
|
||||
getDatabase(function(db) {
|
||||
db.transaction(function (t) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user