-
Notifications
You must be signed in to change notification settings - Fork 425
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1143 from petlyh/peertube-non-urls
Avoid PeerTube accepting non-URLs
- Loading branch information
Showing
11 changed files
with
92 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
.../org/schabi/newpipe/extractor/services/peertube/PeertubeLinkHandlerFactoryTestHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.schabi.newpipe.extractor.services.peertube; | ||
|
||
import org.schabi.newpipe.extractor.exceptions.ParsingException; | ||
import org.schabi.newpipe.extractor.linkhandler.LinkHandlerFactory; | ||
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandlerFactory; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
|
||
public class PeertubeLinkHandlerFactoryTestHelper { | ||
|
||
public static void testDoNotAcceptNonURLs(LinkHandlerFactory linkHandler) | ||
throws ParsingException { | ||
assertFalse(linkHandler.acceptUrl("orchestr/a/")); | ||
assertFalse(linkHandler.acceptUrl("/a/")); | ||
assertFalse(linkHandler.acceptUrl("something/c/")); | ||
assertFalse(linkHandler.acceptUrl("/c/")); | ||
assertFalse(linkHandler.acceptUrl("videos/")); | ||
assertFalse(linkHandler.acceptUrl("I-hate-videos/")); | ||
assertFalse(linkHandler.acceptUrl("/w/")); | ||
assertFalse(linkHandler.acceptUrl("ksmg/w/")); | ||
assertFalse(linkHandler.acceptUrl("a reandom search query")); | ||
assertFalse(linkHandler.acceptUrl("test 230 ")); | ||
assertFalse(linkHandler.acceptUrl("986513")); | ||
} | ||
|
||
public static void testDoNotAcceptNonURLs(ListLinkHandlerFactory linkHandler) | ||
throws ParsingException { | ||
assertFalse(linkHandler.acceptUrl("orchestr/a/")); | ||
assertFalse(linkHandler.acceptUrl("/a/")); | ||
assertFalse(linkHandler.acceptUrl("something/c/")); | ||
assertFalse(linkHandler.acceptUrl("/c/")); | ||
assertFalse(linkHandler.acceptUrl("videos/")); | ||
assertFalse(linkHandler.acceptUrl("I-hate-videos/")); | ||
assertFalse(linkHandler.acceptUrl("/w/")); | ||
assertFalse(linkHandler.acceptUrl("ksmg/w/")); | ||
assertFalse(linkHandler.acceptUrl("a reandom search query")); | ||
assertFalse(linkHandler.acceptUrl("test 230 ")); | ||
assertFalse(linkHandler.acceptUrl("986513")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters