diff --git a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java index 817117611..82bed01c6 100644 --- a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java +++ b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java @@ -900,13 +900,14 @@ public class I2PSnarkServlet extends Default { out.write(trackerLink); } + String encodedBaseName = urlEncode(snark.getBaseName()); // File type icon column out.write("\n"); if (isValid) { // Link to local details page - note that trailing slash on a single-file torrent // gets us to the details page instead of the file. StringBuilder buf = new StringBuilder(128); - buf.append(""); out.write(buf.toString()); @@ -929,7 +930,7 @@ public class I2PSnarkServlet extends Default { out.write(""); if (remaining == 0 || isMultiFile) { StringBuilder buf = new StringBuilder(128); - buf.append("").append(link).append(""); return buf.toString(); } + + /** @since 0.8.13 */ + private static String urlEncode(String s) { + return s.replace("&", "&").replace(" ", "%20").replace(":", "%3A").replace("/", "%2F").replace(";", "%3B"); + } private static final String DOCTYPE = "\n"; private static final String HEADER_A = ""); buf.append("
").append(_("Torrent file")).append(": ").append(snark.getName()); buf.append(""); + } else { + // shouldn't happen + buf.append("Not found
resource=\"").append(r.toString()) + .append("\"
base=\"").append(base) + .append("\"
torrent=\"").append(torrentName) + .append("\""); } if (ls == null) { // We are only showing the torrent info section @@ -2068,7 +2080,7 @@ private static class FetchAndAdd implements Runnable { //if (peerParam != null) // buf.append("\n"); buf.append(_("Torrent was not retrieved from {0}", urlify(_url))); - String link = _url.replace("&", "&").replace(" ", "%20").replace(":", "%3A").replace("/", "%2F"); + String link = urlEncode(_url); /**** FIXME ticket #575 buf.append(" - ["); buf.append(_("Retry")); diff --git a/debian/patches/0001-path-substitution.patch b/debian/patches/0001-path-substitution.patch index 3f8acee3d..febf6581f 100644 --- a/debian/patches/0001-path-substitution.patch +++ b/debian/patches/0001-path-substitution.patch @@ -23,18 +23,7 @@ Debian wrapper.config to try to prevent confusion. java -cp "$I2P/lib/i2p.jar" net.i2p.util.EepGet "$@" --- a/installer/resources/i2prouter +++ b/installer/resources/i2prouter -@@ -28,8 +28,8 @@ - # Note that (percent)INSTALL_PATH and (percent)SYSTEM_java_io_tmpdir - # should have been replaced by the izpack installer. - # If you did not run the installer, replace them with the appropriate path. --I2P="%INSTALL_PATH" --I2PTEMP="%SYSTEM_java_io_tmpdir" -+I2P="/usr/share/i2p" -+I2PTEMP="/tmp" - # PORTABLE installation: - # Use the following instead. - #I2PTEMP="%INSTALL_PATH" -@@ -53,8 +53,8 @@ +@@ -55,8 +55,8 @@ #RUN_AS_USER= # Wrapper @@ -114,46 +103,45 @@ Debian wrapper.config to try to prevent confusion. wrapper.java.additional.4.stripquotes=TRUE # On some IPv6 enabled systems, I2P and other network-enabled java applications -@@ -133,13 +125,7 @@ - wrapper.console.loglevel=INFO - - # Log file to use for wrapper output logging. --# You may wish to change this on linux so the log is --# preserved across OS restarts. +@@ -137,11 +129,7 @@ + # NOTE: On Linux/Mac this is overridden in the i2prouter script; changes here will have no effect. + # Windows users may wish to change this to %APPDATA%\I2P\wrapper.log + # System temp directory: -wrapper.logfile=$SYSTEM_java_io_tmpdir/wrapper.log -# PORTABLE installation: -# Use the following instead. I2P will find the logfile here, -# no need for a wrapper.java.additional line too. -#wrapper.logfile=$INSTALL_PATH/wrapper.log -+wrapper.logfile=/tmp/wrapper.log ++#wrapper.logfile=/tmp/wrapper.log # Format of output for the log file. # The format consists of the tokens 'L' for log level, 'P' for prefix, 'D' for thread, -@@ -205,10 +191,7 @@ - # you should copy this file, change the location or file name, - # and edit the i2prouter script to change the WRAPPER_CONF setting - # to point to the new wrapper.config location. --wrapper.java.pidfile=$SYSTEM_java_io_tmpdir/routerjvm.pid +@@ -211,11 +199,7 @@ + # Linux/Mac users, do not set here, see settings in the i2prouter script. + # Directory must exist or the wrapper will fail to start. + # System temp directory: +-#wrapper.java.pidfile=$SYSTEM_java_io_tmpdir/routerjvm.pid -# PORTABLE installation: -# Use the following instead. -#wrapper.java.pidfile=$INSTALL_PATH/routerjvm.pid -+wrapper.java.pidfile=/tmp/routerjvm.pid - # pid file for the service monitoring the JVM +-# pid file for the service monitoring the JVM ++#wrapper.java.pidfile=/tmp/routerjvm.pid # # From i2prouter: -@@ -219,10 +202,7 @@ # - # This means i2prouter looks for './i2p.pid'. - # See comments above for wrapper.java.pidfile --wrapper.pidfile=$SYSTEM_java_io_tmpdir/i2p.pid +@@ -229,10 +213,7 @@ + # Linux/Mac users, do not set here, see settings in the i2prouter script. + # Directory must exist or the wrapper will fail to start. + # System temp directory: +-#wrapper.pidfile=$SYSTEM_java_io_tmpdir/i2p.pid -# PORTABLE installation: -# Use the following instead. -#wrapper.pidfile=$INSTALL_PATH/i2p.pid -+wrapper.pidfile=/tmp/i2p.pid ++#wrapper.pidfile=/tmp/i2p.pid #******************************************************************** # Wrapper General Properties -@@ -239,30 +219,3 @@ +@@ -249,30 +230,3 @@ wrapper.umask=0022 wrapper.java.umask=0022 wrapper.logfile.umask=077 diff --git a/history.txt b/history.txt index 50df2cbae..acb141986 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,9 @@ +2012-02-10 zzz + * WorkingDir: Fix detection of migrated directory + +2012-02-09 zzz + * i2psnark: Escape semicolons + 2012-02-04 zzz * Deprecate util classes used only by installer * ProfileOrganizer: Add profileOrganizer.sameCountryBonus config diff --git a/installer/resources/i2prouter b/installer/resources/i2prouter index 806404665..7623bec10 100644 --- a/installer/resources/i2prouter +++ b/installer/resources/i2prouter @@ -41,7 +41,7 @@ APP_LONG_NAME="I2P Service" # gettext - we look for it in the path # fallback to echo is below, we can't set it to echo here. -GETTEXT=$(which gettext) +GETTEXT=$(which gettext > /dev/null 2>&1) # If specified, the Wrapper will be run as the specified user. # IMPORTANT - Make sure that the user has the required privileges to write @@ -306,11 +306,7 @@ ANCHORFILE="$PIDDIR/$APP_NAME.anchor" COMMANDFILE="$PIDDIR/$APP_NAME.command" STATUSFILE="$PIDDIR/$APP_NAME.status" JAVASTATUSFILE="$PIDDIR/$APP_NAME.java.status" -if [ $(which awk) ]; then - PIDFILE="$(awk -F'=' '/^ *wrapper\.pidfile/{print $2}' "$WRAPPER_CONF")" -else - PIDFILE="$PIDDIR/$APP_NAME.pid" -fi +PIDFILE="$PIDDIR/$APP_NAME.pid" LOCKDIR="/var/lock/subsys" LOCKFILE="$LOCKDIR/$APP_NAME" pid="" @@ -480,7 +476,7 @@ gettext() { # Call external gettext using our own translation files. # Don't attempt to translate via the wrapper, # it probably isn't supported in the community edition. - if [ "X${LANG#en}" = "X$LANG" ] && [ $(which $GETTEXT) ] ; then + if [ "X${LANG#en}" = "X$LANG" ] && [ $(which $GETTEXT > /dev/null 2>&1) ] ; then TEXTDOMAINDIR=$I2P/locale $GETTEXT -d i2prouter "$1" if [ $? != 0 ] ; then echo "$1" diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 5a58b19bc..e36cd3b14 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 11; + public final static long BUILD = 12; /** for example "-test" */ public final static String EXTRA = ""; diff --git a/router/java/src/net/i2p/router/startup/WorkingDir.java b/router/java/src/net/i2p/router/startup/WorkingDir.java index 9a110a25b..f5c2645cc 100644 --- a/router/java/src/net/i2p/router/startup/WorkingDir.java +++ b/router/java/src/net/i2p/router/startup/WorkingDir.java @@ -184,20 +184,23 @@ public class WorkingDir { /** * Tests if dir has been set up as a I2P working directory.
- * Returns false if a directory is empty, or contains nothing besides - * subdirectories named plugins and/or logs.
- * Returns true if the directory contains something not named - * plugins or logs.
+ * Returns false if a directory is empty, or contains nothing that + * is usually migrated from the base install. * This allows to pre-install plugins before the first router start. + * @return true if already set up */ private static boolean isSetup(File dir) { if (dir.isDirectory()) { String[] files = dir.list(); if (files == null) return false; - for (String file: files) - if (!"plugins".equals(file) && !"logs".equals(file)) - return true; + String migrated[] = MIGRATE_BASE.split(","); + for (String file: files) { + for (int i = 0; i < migrated.length; i++) { + if (file.equals(migrated[i])) + return true; + } + } } return false; }