Fix URLs for models with special characters in their name

This commit is contained in:
0xb00bface 2020-10-05 18:44:16 +02:00
parent eaf5fd2ed7
commit 2dd32fed0c
1 changed files with 3 additions and 4 deletions

View File

@ -4,8 +4,6 @@ import static ctbrec.Model.State.*;
import static ctbrec.io.HttpConstants.*;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
@ -51,7 +49,8 @@ public class StripchatModel extends AbstractModel {
}
private JSONObject loadModelInfo() throws IOException {
String url = getSite().getBaseUrl() + "/api/front/users/username/" + URLEncoder.encode(getName(), StandardCharsets.UTF_8.name());
String name = getName();
String url = getSite().getBaseUrl() + "/api/front/users/username/" + name;
Request req = new Request.Builder()
.url(url)
.header(ACCEPT, MIMETYPE_APPLICATION_JSON)
@ -72,7 +71,7 @@ public class StripchatModel extends AbstractModel {
@Override
public List<StreamSource> getStreamSources() throws IOException, ExecutionException, ParseException, PlaylistException, JAXBException {
String name = URLEncoder.encode(getName(), StandardCharsets.UTF_8.name());
String name = getName();
String url = getSite().getBaseUrl() + "/api/front/models/username/" + name + "/cam?triggerRequest=loadCam";
Request req = new Request.Builder()
.url(url)