--- bin/upload.old 2001-08-21 22:17:27.000000000 -0700
+++ bin/upload 2003-01-28 09:24:08.000000000 -0800
@@ -339,10 +339,12 @@
my( $fileSize, $fileUser, $fileDate, $fileVersion ) = "";
if( ! $doChangeProperties ) {
- # check if file exists and has non zero size
+ # check if file doesn't exist and is zero size
+ # i.e., allow truncation of existing files
+ # don't allow upload of initially empty files
my $size = -s $tmpFilename;
- if( ! -e $tmpFilename || ! $size ) {
- handleError( $noredirect, "File missing or zero size",
+ if( ! -e $tmpFilename && ! $size ) {
+ handleError( $noredirect, "File missing and zero size",
$query, $webName, $topic, "oopsupload", $fileName );
return;
}
@@ -388,6 +390,10 @@
&TWiki::Store::writeLog( "upload", "$webName.$topic", $fileName );
#FIXE also do log for change property?
}
+
+ if (! $size ) {
+ &TWiki::Store::pruneAttachment( $webName, $topic, $fileName );
+ }
}
--- lib/TWiki/Store.pm.bak 2001-11-30 17:56:40.000000000 -0800
+++ lib/TWiki/Store.pm 2003-01-28 09:34:04.000000000 -0800
@@ -196,7 +196,7 @@
if( ! -d "$attDir/$attachment" ) {
unlink( "$attDir/$attachment" ) || warn "Couldn't remove $attDir/$attachment";
if( $attachment !~ /,v$/ ) {
- writeLog( "erase", "$web.$topic.$attachment" );
+ writeLog( "erase", "$web.$topic.$attachment", "" );
}
}
}
@@ -223,6 +223,22 @@
}
# =========================
+# Erase an empty-file attachment, but keep it in RCS
+sub pruneAttachment
+{
+ my( $web, $topic, $fileName ) = @_;
+ my $attachment = getFileName( $web, $topic, $fileName );
+ my $attDir = getFileDir( $web, $topic, 1, "" );
+ if ( -e "$attachment" && -z "$attachment" &&
+ ( -e "$attachment,v" || -e "$attDir/RCS/$attachment,v" ))
+ {
+ unlink( "$attachment" );
+ }
+
+ writeLog( "prune", "$web.$topic.$attachment", "" );
+}
+
+# =========================
# Move an attachment from one topic to another.
# If there is a problem an error string is returned.
# The caller to this routine check that all topics are valid and
--- lib/TWiki/Plugins/TWikiDrawPlugin/src/CH/ifa/draw/contrib/PolygonFigure.java.bak 2002-09-30 21:03:36.000000000 -0700
+++ lib/TWiki/Plugins/TWikiDrawPlugin/src/CH/ifa/draw/contrib/PolygonFigure.java 2003-01-28 08:55:54.000000000 -0800
@@ -8,6 +8,7 @@
import java.awt.*;
import java.util.*;
import java.io.*;
+import java.net.*;
import CH.ifa.draw.framework.*;
import CH.ifa.draw.util.*;
import CH.ifa.draw.standard.*;
@@ -311,6 +312,9 @@
String sense = (String)getAttribute("Sensitive");
if (sense == null || sense.length() == 0)
return "";
+ try {
+ sense = URLDecoder.decode(sense);
+ } catch (Exception e) {}
Rectangle box = displayBox();
String coords = "";
for (int i = 0; i < fPoly.npoints; i++) {
@@ -318,8 +322,8 @@
coords += ",";
coords += fPoly.xpoints[i] + "," + fPoly.ypoints[i];
}
- return "\n";
+ return "\n";
}
public void write(StorableOutput dw) {
--- lib/TWiki/Plugins/TWikiDrawPlugin/src/CH/ifa/draw/figures/EllipseFigure.java.bak 2002-09-30 21:03:44.000000000 -0700
+++ lib/TWiki/Plugins/TWikiDrawPlugin/src/CH/ifa/draw/figures/EllipseFigure.java 2003-01-28 08:56:40.000000000 -0800
@@ -7,6 +7,7 @@
import java.awt.*;
import java.io.*;
+import java.net.*;
import java.util.Vector;
import CH.ifa.draw.util.*;
import CH.ifa.draw.framework.*;
@@ -88,6 +89,9 @@
public String getMap() {
String sense = (String)getAttribute("Sensitive");
if (sense != null && sense.length() > 0) {
+ try {
+ sense = URLDecoder.decode(sense);
+ } catch (Exception e) {}
Rectangle box = displayBox();
double w = box.width / 2.0;
double h = box.height / 2.0;
--- lib/TWiki/Plugins/TWikiDrawPlugin/src/CH/ifa/draw/figures/PolyLineFigure.java.bak 2002-10-03 20:36:08.000000000 -0700
+++ lib/TWiki/Plugins/TWikiDrawPlugin/src/CH/ifa/draw/figures/PolyLineFigure.java 2003-01-28 08:57:03.000000000 -0800
@@ -8,6 +8,7 @@
import java.awt.*;
import java.util.*;
import java.io.*;
+import java.net.*;
import CH.ifa.draw.framework.*;
import CH.ifa.draw.standard.*;
import CH.ifa.draw.util.*;
@@ -315,6 +316,9 @@
String sensitive = (String)getAttribute("Sensitive");
if (sensitive == null || sensitive.length() == 0)
return "";
+ try {
+ sensitive = URLDecoder.decode(sensitive);
+ } catch (Exception e) {}
Enumeration k = fPoints.elements();
boolean first = true;
String forwards = "", backwards = "";
--- lib/TWiki/Plugins/TWikiDrawPlugin/src/CH/ifa/draw/figures/RectangleFigure.java.bak 2002-09-30 21:03:44.000000000 -0700
+++ lib/TWiki/Plugins/TWikiDrawPlugin/src/CH/ifa/draw/figures/RectangleFigure.java 2003-01-28 08:57:23.000000000 -0800
@@ -7,6 +7,7 @@
import java.awt.*;
import java.io.*;
+import java.net.*;
import java.util.Vector;
import CH.ifa.draw.framework.*;
import CH.ifa.draw.standard.*;
@@ -80,6 +81,9 @@
public String getMap() {
String sense = (String)getAttribute("Sensitive");
if (sense != null && sense.length() > 0) {
+ try {
+ sense = URLDecoder.decode(sense);
+ } catch (Exception e) {}
Rectangle box = displayBox();
return " 0) {
+ try {
+ sense = URLDecoder.decode(sense);
+ } catch (Exception e) {}
Rectangle box = displayBox();
return "\n" + map +
"\n" +
"\n" +
"\n" +
"\n" +
"";
savedMap = app.post(
savePath, "", "text/plain", mapPath + ".map",
map, "TWikiDraw map file");
+ } else {
+ // erase any previous map file
+ String mapPath = drawingPath.substring(0, drawingPath.length() - 5);
+ savedMap = app.post( savePath, "", "text/plain", mapPath + ".map", "", "" );
}
// get pathname of the SVG file
--- lib/TWiki/Plugins/TWikiDrawPlugin/src/CH/ifa/draw/standard/ConnectionHandle.java.bak 2001-09-15 12:07:46.000000000 -0700
+++ lib/TWiki/Plugins/TWikiDrawPlugin/src/CH/ifa/draw/standard/ConnectionHandle.java 2003-01-28 09:42:55.000000000 -0800
@@ -110,7 +110,10 @@
* cloned.
*/
protected ConnectionFigure createConnection() {
- return (ConnectionFigure)fPrototype.clone();
+ try {
+ return (ConnectionFigure)fPrototype.clone();
+ } catch (Exception e) {}
+ return null;
}
/**
--- lib/TWiki/Plugins/TWikiDrawPlugin/src/CH/ifa/draw/standard/ConnectionTool.java.bak 2001-09-15 12:07:46.000000000 -0700
+++ lib/TWiki/Plugins/TWikiDrawPlugin/src/CH/ifa/draw/standard/ConnectionTool.java 2003-01-28 09:42:45.000000000 -0800
@@ -159,7 +159,10 @@
* cloned.
*/
protected ConnectionFigure createConnection() {
- return (ConnectionFigure)fPrototype.clone();
+ try {
+ return (ConnectionFigure)fPrototype.clone();
+ } catch (Exception e) {}
+ return null;
}
/**