[PeerTube] Prepend "accounts/" to channel id for backward compatibility

This commit is contained in:
Stypox 2020-04-11 15:52:59 +02:00
parent 492db83ccf
commit d130fd79c3
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
1 changed files with 9 additions and 3 deletions

View File

@ -126,9 +126,15 @@ public class PeertubeAccountExtractor extends ChannelExtractor {
}
@Override
public void onFetchPage(final Downloader downloader) throws IOException, ExtractionException {
final Response response = downloader.get(
baseUrl + PeertubeChannelLinkHandlerFactory.API_ENDPOINT + getId());
public void onFetchPage(@Nonnull Downloader downloader) throws IOException, ExtractionException {
String accountUrl = baseUrl + PeertubeChannelLinkHandlerFactory.API_ENDPOINT;
if (getId().contains("accounts/")) {
accountUrl += getId();
} else {
accountUrl += "accounts/" + getId();
}
final Response response = downloader.get(accountUrl);
if (response != null && response.responseBody() != null) {
setInitialData(response.responseBody());
} else {