forked from I2P_Developers/i2p.i2p
propagate from branch 'i2p.i2p' (head c62904685f0153a5b8cd032e8b3f1c4f64c5bec9)
to branch 'i2p.i2p.str4d.ui' (head 2a82ccb644906256af7bd0827725dc83e4c76be2)
This commit is contained in:
@@ -893,11 +893,16 @@ public class TrackerClient implements Runnable {
|
||||
} catch (URISyntaxException use) {
|
||||
return false;
|
||||
}
|
||||
String path = url.getPath();
|
||||
if (path == null || !path.startsWith("/"))
|
||||
return false;
|
||||
return "http".equals(url.getScheme()) && url.getHost() != null &&
|
||||
(url.getHost().endsWith(".i2p") || url.getHost().equals("i2p"));
|
||||
}
|
||||
|
||||
/**
|
||||
* This also validates the URL.
|
||||
*
|
||||
* @param ann an announce URL non-null
|
||||
* @return a Hash for i2p hosts only, null otherwise
|
||||
* @since 0.9.5
|
||||
@@ -914,8 +919,12 @@ public class TrackerClient implements Runnable {
|
||||
String host = url.getHost();
|
||||
if (host == null)
|
||||
return null;
|
||||
if (host.endsWith(".i2p"))
|
||||
if (host.endsWith(".i2p")) {
|
||||
String path = url.getPath();
|
||||
if (path == null || !path.startsWith("/"))
|
||||
return null;
|
||||
return ConvertToHash.getHash(host);
|
||||
}
|
||||
if (host.equals("i2p")) {
|
||||
String path = url.getPath();
|
||||
if (path == null || path.length() < 517 ||
|
||||
@@ -941,6 +950,10 @@ public class TrackerClient implements Runnable {
|
||||
int consecutiveFails;
|
||||
int seenPeers;
|
||||
|
||||
/**
|
||||
* @param a must be a valid http URL with a path
|
||||
* @param p true if primary
|
||||
*/
|
||||
public TCTracker(String a, boolean p)
|
||||
{
|
||||
announce = a;
|
||||
|
||||
@@ -1085,8 +1085,9 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
// should be only one
|
||||
if (df.delete())
|
||||
_manager.addMessage(_t("Data file deleted: {0}", df.getAbsolutePath()));
|
||||
else
|
||||
else if (df.exists())
|
||||
_manager.addMessage(_t("Data file could not be deleted: {0}", df.getAbsolutePath()));
|
||||
// else already gone
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1094,8 +1095,9 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
for (File df : storage.getFiles()) {
|
||||
if (df.delete()) {
|
||||
//_manager.addMessage(_t("Data file deleted: {0}", df.getAbsolutePath()));
|
||||
} else {
|
||||
} else if (df.exists()) {
|
||||
_manager.addMessage(_t("Data file could not be deleted: {0}", df.getAbsolutePath()));
|
||||
// else already gone
|
||||
}
|
||||
}
|
||||
// step 2 delete dirs bottom-up
|
||||
@@ -1109,11 +1111,12 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
if (df.delete()) {
|
||||
ok = true;
|
||||
//_manager.addMessage(_t("Data dir deleted: {0}", df.getAbsolutePath()));
|
||||
} else {
|
||||
} else if (df.exists()) {
|
||||
ok = false;
|
||||
_manager.addMessage(_t("Directory could not be deleted: {0}", df.getAbsolutePath()));
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Could not delete dir " + df);
|
||||
// else already gone
|
||||
}
|
||||
}
|
||||
// step 3 message for base (last one)
|
||||
|
||||
Reference in New Issue
Block a user