1
0
mirror of https://github.com/louislam/uptime-kuma.git synced 2025-01-02 00:10:42 +02:00

Updated: Enhance null safety and set default URL in EditMonitor.vue

- Added optional chaining to safely access `this.monitor.hostname`.
- Introduced default URL (`https://`) assignment to `this.monitor.url`.
- Ensured `hostname` is trimmed after the URL is set.

modified: src/pages/EditMonitor.vue
This commit is contained in:
GJS 2024-12-29 07:31:50 +01:00
parent 488e542ad8
commit 33ebfefc58
No known key found for this signature in database
GPG Key ID: BE32D9EAF927E85B

View File

@ -1719,7 +1719,12 @@ message HealthCheckResponse {
this.monitor.headers = JSON.stringify(JSON.parse(this.monitor.headers), null, 4);
}
if (this.monitor.hostname) {
// Check if the 'monitor' object exists and contains a 'hostname' property.
if (this.monitor?.hostname) {
// Initialize the 'url' property of 'monitor' to the base URL scheme.
this.monitor.url = "https://";
// Remove any leading or trailing spaces from the 'hostname' value.
this.monitor.hostname = this.monitor.hostname.trim();
}