File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 88 "strings"
99 "sync"
1010 "time"
11+ "regexp"
1112
1213 "github.com/AlexxIT/go2rtc/internal/api"
1314 "github.com/AlexxIT/go2rtc/internal/app"
@@ -132,7 +133,11 @@ func apiWS(w http.ResponseWriter, r *http.Request) {
132133 if handler := wsHandlers [msg .Type ]; handler != nil {
133134 go func () {
134135 if err = handler (tr , msg ); err != nil {
135- tr .Write (& Message {Type : "error" , Value : msg .Type + ": " + err .Error ()})
136+ // Some streams such as ffmpeg might return credentials on error messages
137+ errMsg := err .Error ()
138+ sanitizer := regexp .MustCompile (`(\w+)://(.*)@` )
139+ errMsg = sanitizer .ReplaceAllString (errMsg , "$1://******@" )
140+ tr .Write (& Message {Type : "error" , Value : msg .Type + ": " + errMsg })
136141 }
137142 }()
138143 }
You can’t perform that action at this time.
0 commit comments