Code refactoring for #1992
This commit is contained in:
@@ -34,9 +34,6 @@ func Init() {
|
||||
var log zerolog.Logger
|
||||
|
||||
func streamOnvif(rawURL string) (core.Producer, error) {
|
||||
// Split the ONVIF URL to extract hash-based arguments
|
||||
rawURL, rawQuery, _ := strings.Cut(rawURL, "#")
|
||||
|
||||
client, err := onvif.NewClient(rawURL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -48,8 +45,8 @@ func streamOnvif(rawURL string) (core.Producer, error) {
|
||||
}
|
||||
|
||||
// Append hash-based arguments to the retrieved URI
|
||||
if rawQuery != "" {
|
||||
uri = uri + "#" + rawQuery
|
||||
if i := strings.IndexByte(rawURL, '#'); i > 0 {
|
||||
uri += rawURL[i:]
|
||||
}
|
||||
|
||||
log.Debug().Msgf("[onvif] new uri=%s", uri)
|
||||
|
||||
Reference in New Issue
Block a user