1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-26 23:34:53 +02:00

Added some more checks to avoid downloading invaild urls

This commit is contained in:
cyian-1756
2019-03-12 03:43:21 -04:00
parent beda41e069
commit 628669c750

View File

@@ -237,6 +237,12 @@ public abstract class AbstractRipper
* False if failed to download
*/
protected boolean addURLToDownload(URL url, String prefix, String subdirectory, String referrer, Map<String, String> cookies, String fileName, String extension, Boolean getFileExtFromMIME) {
// A common bug is rippers adding urls that are just "http:". This rejects said urls
if (url.toExternalForm().equals("http:") || url.toExternalForm().equals("https:")) {
LOGGER.info(url.toExternalForm() + " is a invalid url amd will be changed");
return false;
}
// Make sure the url doesn't contain any spaces as that can cause a 400 error when requesting the file
if (url.toExternalForm().contains(" ")) {
// If for some reason the url with all spaces encoded as %20 is malformed print an error
@@ -425,6 +431,7 @@ public abstract class AbstractRipper
* Notifies observers and updates state if all files have been ripped.
*/
void checkIfComplete() {
LOGGER.debug("Checkifcomplete was called");
if (observer == null) {
LOGGER.debug("observer is null");
return;