mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-03-31 17:53:44 -04:00
fix #182: error on upgrade when onvif_host empty
This commit is contained in:
parent
af9c8bb05a
commit
cf492a2ffa
@ -6,6 +6,11 @@ changes, see Git history.
|
|||||||
Each release is tagged in Git and on the Docker repository
|
Each release is tagged in Git and on the Docker repository
|
||||||
[`scottlamb/moonfire-nvr`](https://hub.docker.com/r/scottlamb/moonfire-nvr).
|
[`scottlamb/moonfire-nvr`](https://hub.docker.com/r/scottlamb/moonfire-nvr).
|
||||||
|
|
||||||
|
## unreleased
|
||||||
|
|
||||||
|
* fix [#182](https://github.com/scottlamb/moonfire-nvr/issues/182): error
|
||||||
|
on upgrade from schema 6 to schema 7 when a camera's `onvif_host` is empty.
|
||||||
|
|
||||||
## `v0.7.1` (2021-10-27)
|
## `v0.7.1` (2021-10-27)
|
||||||
|
|
||||||
* bugfix: editing a camera from `nvr config` would erroneously clear the
|
* bugfix: editing a camera from `nvr config` would erroneously clear the
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
// SPDX-License-Identifier: GPL-v3.0-or-later WITH GPL-3.0-linking-exception
|
// SPDX-License-Identifier: GPL-v3.0-or-later WITH GPL-3.0-linking-exception
|
||||||
|
|
||||||
/// Upgrades a version 6 schema to a version 7 schema.
|
/// Upgrades a version 6 schema to a version 7 schema.
|
||||||
use failure::{format_err, Error};
|
use failure::{format_err, Error, ResultExt};
|
||||||
use fnv::FnvHashMap;
|
use fnv::FnvHashMap;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
use rusqlite::{named_params, params};
|
use rusqlite::{named_params, params};
|
||||||
@ -255,8 +255,13 @@ fn copy_cameras(tx: &rusqlite::Transaction) -> Result<(), Error> {
|
|||||||
let config = CameraConfig {
|
let config = CameraConfig {
|
||||||
description: description.take().unwrap_or_default(),
|
description: description.take().unwrap_or_default(),
|
||||||
onvif_base_url: onvif_host
|
onvif_base_url: onvif_host
|
||||||
|
// Older releases set the onvif host to the empty string instead
|
||||||
|
// of using a SQL NULL, so convert empty to None here.
|
||||||
|
// https://github.com/scottlamb/moonfire-nvr/issues/182
|
||||||
|
.filter(|h| !h.is_empty())
|
||||||
.map(|h| Url::parse(&format!("http://{}/", h)))
|
.map(|h| Url::parse(&format!("http://{}/", h)))
|
||||||
.transpose()?,
|
.transpose()
|
||||||
|
.with_context(|_| "bad onvif_host")?,
|
||||||
username: username.take().unwrap_or_default(),
|
username: username.take().unwrap_or_default(),
|
||||||
password: password.take().unwrap_or_default(),
|
password: password.take().unwrap_or_default(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user