Skip to content

Commit

Permalink
Restore URL check
Browse files Browse the repository at this point in the history
  • Loading branch information
Isira-Seneviratne committed Dec 7, 2024
1 parent a67873a commit 4869ab1
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
Expand Down Expand Up @@ -148,11 +149,15 @@ public List<SubscriptionItem> fromCsvInputStream(@Nonnull final InputStream cont
.map(values -> {
// Channel URL from second entry
final String channelUrl = values[1].replace("http://", "https://");
// Channel title from third entry
final String title = values[2];

return new SubscriptionItem(service.getServiceId(), channelUrl, title);
if (!channelUrl.startsWith(BASE_CHANNEL_URL)) {
return null;
} else {
// Channel title from third entry
final String title = values[2];
return new SubscriptionItem(service.getServiceId(), channelUrl, title);
}
})
.filter(Objects::nonNull)
.collect(Collectors.toUnmodifiableList());
} catch (final UncheckedIOException | IOException e) {
throw new InvalidSourceException("Error reading CSV file", e);
Expand Down

0 comments on commit 4869ab1

Please sign in to comment.