[ipcamera] Added URL encoding fix for passwords that contains special characters. (#13035)
* Added URL encoding fix for passwords that contains special characters. * Simplified as proposed. Signed-off-by: Thomas Burri <th@thonjato.ch>
This commit is contained in:
parent
5f115295a4
commit
f203b3f202
|
@ -18,6 +18,8 @@ import java.io.BufferedReader;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -56,12 +58,13 @@ public class Ffmpeg {
|
|||
public Ffmpeg(IpCameraHandler handle, FFmpegFormat format, String ffmpegLocation, String inputArguments,
|
||||
String input, String outArguments, String output, String username, String password) {
|
||||
this.format = format;
|
||||
this.password = password;
|
||||
this.password = URLEncoder.encode(password, StandardCharsets.UTF_8);
|
||||
|
||||
ipCameraHandler = handle;
|
||||
String altInput = input;
|
||||
// Input can be snapshots not just rtsp or http
|
||||
if (!password.isEmpty() && !input.contains("@") && input.contains("rtsp")) {
|
||||
String credentials = username + ":" + password + "@";
|
||||
String credentials = username + ":" + this.password + "@";
|
||||
// will not work for https: but currently binding does not use https
|
||||
altInput = input.substring(0, 7) + credentials + input.substring(7);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue