404'd images are marked as "errored" #13
This commit is contained in:
parent
a5e3acc386
commit
7f390962b6
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
||||
<groupId>com.rarchives.ripme</groupId>
|
||||
<artifactId>ripme</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0.10</version>
|
||||
<version>1.0.11</version>
|
||||
<name>ripme</name>
|
||||
<url>http://rip.rarchives.com</url>
|
||||
<properties>
|
||||
|
@ -69,7 +69,19 @@ public class DownloadFileThread extends Thread {
|
||||
.timeout(TIMEOUT)
|
||||
.maxBodySize(MAX_BODY_SIZE)
|
||||
.execute();
|
||||
FileOutputStream out = (new FileOutputStream(saveAs));
|
||||
if (response.statusCode() != 200) {
|
||||
logger.error("[!] Non-OK status code " + response.statusCode() + " while downloading from " + url);
|
||||
observer.downloadErrored(url, "Non-OK status code " + response.statusCode() + " while downloading " + url.toExternalForm());
|
||||
return;
|
||||
}
|
||||
byte[] bytes = response.bodyAsBytes();
|
||||
if (bytes.length == 503 && url.getHost().endsWith("imgur.com")) {
|
||||
// Imgur image with 503 bytes is "404"
|
||||
logger.error("[!] Imgur image is 404 (503 bytes long): " + url);
|
||||
observer.downloadErrored(url, "Imgur image is 404: " + url.toExternalForm());
|
||||
return;
|
||||
}
|
||||
FileOutputStream out = new FileOutputStream(saveAs);
|
||||
out.write(response.bodyAsBytes());
|
||||
out.close();
|
||||
break; // Download successful: break out of infinite loop
|
||||
|
@ -17,7 +17,7 @@ import org.jsoup.nodes.Document;
|
||||
public class UpdateUtils {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(UpdateUtils.class);
|
||||
private static final String DEFAULT_VERSION = "1.0.10";
|
||||
private static final String DEFAULT_VERSION = "1.0.11";
|
||||
private static final String updateJsonURL = "http://rarchives.com/ripme.json";
|
||||
private static final String updateJarURL = "http://rarchives.com/ripme.jar";
|
||||
private static final String mainFileName = "ripme.jar";
|
||||
|
@ -12,7 +12,6 @@ import java.util.jar.JarFile;
|
||||
|
||||
import org.apache.commons.configuration.ConfigurationException;
|
||||
import org.apache.commons.configuration.PropertiesConfiguration;
|
||||
import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
@ -34,7 +33,6 @@ public class Utils {
|
||||
configPath = configFile;
|
||||
}
|
||||
config = new PropertiesConfiguration(configPath);
|
||||
config.setReloadingStrategy(new FileChangedReloadingStrategy());
|
||||
logger.info("Loaded " + config.getPath());
|
||||
} catch (Exception e) {
|
||||
logger.error("[!] Failed to load properties file from " + configFile, e);
|
||||
|
Loading…
Reference in New Issue
Block a user