Author: bombe
Date: 2006-05-03 22:01:19 +0000 (Wed, 03 May 2006)
New Revision: 8601
Modified:
trunk/freenet/src/freenet/node/TextModeClientInterface.java
trunk/freenet/src/freenet/node/Version.java
Log:
enhance PUTFILE command to take mime type as optional second parameter
Modified: trunk/freenet/src/freenet/node/TextModeClientInterface.java
===================================================================
--- trunk/freenet/src/freenet/node/TextModeClientInterface.java 2006-05-03
21:28:27 UTC (rev 8600)
+++ trunk/freenet/src/freenet/node/TextModeClientInterface.java 2006-05-03
22:01:19 UTC (rev 8601)
@@ -129,7 +129,7 @@
sb.append("PUT:<text> - Put a single line of text to a CHK and return
the key.\r\n");
sb.append("GETCHK:\r\n<text, until a . on a line by itself> - Get the
key that would be returned if the document was inserted.\r\n");
sb.append("GETCHK:<text> - Get the key that would be returned if the
line was inserted.\r\n");
- sb.append("PUTFILE:<filename> - Put a file from disk.\r\n");
+ sb.append("PUTFILE:<filename>[#<mimetype>] - Put a file from
disk.\r\n");
sb.append("GETFILE:<filename> - Fetch a key and put it in a file. If
the key includes a filename we will use it but we will not overwrite local
files.\r\n");
sb.append("GETCHKFILE:<filename> - Get the key that would be returned
if we inserted the file.\r\n");
sb.append("PUTDIR:<path>[#<defaultfile>] - Put the entire directory
from disk.\r\n");
@@ -426,6 +426,12 @@
line = line.substring(1);
while(line.length() > 0 && line.charAt(line.length()-1) == ' ')
line = line.substring(0, line.length()-2);
+ String mimeType = DefaultMIMETypes.guessMIMEType(line);
+ if (line.indexOf('#') > -1) {
+ String[] splittedLine = line.split("#");
+ line = splittedLine[0];
+ mimeType = splittedLine[1];
+ }
File f = new File(line);
outsb.append("Attempting to read file "+line);
long startTime = System.currentTimeMillis();
@@ -435,8 +441,7 @@
}
// Guess MIME type
- String mimeType = DefaultMIMETypes.guessMIMEType(line);
- outsb.append("Using MIME type: "+mimeType);
+ outsb.append("Using MIME type: "+mimeType + "\r\n");
if(mimeType.equals(DefaultMIMETypes.DEFAULT_MIME_TYPE))
mimeType = ""; // don't need to override it
Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2006-05-03 21:28:27 UTC (rev
8600)
+++ trunk/freenet/src/freenet/node/Version.java 2006-05-03 22:01:19 UTC (rev
8601)
@@ -20,7 +20,7 @@
public static final String protocolVersion = "1.0";
/** The build number of the current revision */
- private static final int buildNumber = 670;
+ private static final int buildNumber = 671;
/** Oldest build of Fred we will talk to */
private static final int lastGoodBuild = 591;