mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-09-25 15:00:26 +01:00
Fix nulls showing in certificate rows
This commit is contained in:
@@ -15,6 +15,16 @@ Model.knex(db());
|
|||||||
|
|
||||||
const boolFields = ["is_deleted"];
|
const boolFields = ["is_deleted"];
|
||||||
|
|
||||||
|
const cleanDomainNames = (domainNames) => {
|
||||||
|
// Sort domain_names
|
||||||
|
if (typeof domainNames !== "undefined") {
|
||||||
|
const newDomainNames = domainNames.filter((name) => name !== null);
|
||||||
|
newDomainNames.sort();
|
||||||
|
return newDomainNames;
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
};
|
||||||
|
|
||||||
class Certificate extends Model {
|
class Certificate extends Model {
|
||||||
$beforeInsert() {
|
$beforeInsert() {
|
||||||
this.created_on = now();
|
this.created_on = now();
|
||||||
@@ -26,25 +36,17 @@ class Certificate extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Default for domain_names
|
// Default for domain_names
|
||||||
if (typeof this.domain_names === "undefined") {
|
this.domain_names = cleanDomainNames(this.domain_names);
|
||||||
this.domain_names = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Default for meta
|
// Default for meta
|
||||||
if (typeof this.meta === "undefined") {
|
if (typeof this.meta === "undefined") {
|
||||||
this.meta = {};
|
this.meta = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
this.domain_names.sort();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$beforeUpdate() {
|
$beforeUpdate() {
|
||||||
this.modified_on = now();
|
this.modified_on = now();
|
||||||
|
this.domain_names = cleanDomainNames(this.domain_names);
|
||||||
// Sort domain_names
|
|
||||||
if (typeof this.domain_names !== "undefined") {
|
|
||||||
this.domain_names.sort();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$parseDatabaseJson(json) {
|
$parseDatabaseJson(json) {
|
||||||
|
|||||||
Reference in New Issue
Block a user