// initialize it with known data..
// that should wipe out dupes.
- var matches = this.execute("SELECT id FROM Attachment WHERE id = %d".printf(
+ var matches = this.query("SELECT count(id) FROM Attachment WHERE id = %d".printf(
int.parse(sid)));
- if (matches == "") {
+ if (matches == "0") {
// our old mailfort code deleted the crap out of old records...
// if this occurs we will need to create the record again..
this.fix_deleted_attachment_db(int.parse(sid),attachment);
// initialize it with known data..
// that should wipe out dupes.
- var filesize = this.execute("SELECT filesize FROM Attachment WHERE id = %d".printf(
+ var filesize = this.query("SELECT filesize FROM Attachment WHERE id = %d".printf(
int.parse(sid)));
if (filesize=="") {
var filename = attachment.get_header("X-strip-content-name");
var file_path = attachment.get_header("X-strip-path");
var fn = StripApplication.opt_target_path + "/" + file_path;
+
+
+ if (!FileUtils.test (fn, FileTest.EXISTS)) {
+ GLib.debug("SKIP -- file does not exist");
+ return;
+ }
+
var chksum = this.md5_file(fn);
var mime_type = attachment.get_header("X-strip-content-type");
,GLib.FileQueryInfoFlags.NONE,null);
var file_size = (int) fileinfo.get_size();
- if (!FileUtils.test (fn, FileTest.EXISTS)) {
- GLib.debug("SKIP -- file does not exist");
- }
this.real_query(-1, """
target_fn = StripApplication.opt_target_path + "/" + this.created_dir +"/"+ file_id + "-" + GLib.Uri.escape_string(filename,"", false);
}
- var stored = "/" + this.created_dir +"/"+ file_id + "-" + filename;
+ var stored = "/" + this.created_dir +"/"+ file_id + "-" + GLib.Uri.escape_string(filename,"", false);
this.query("""
SELECT attachment_update_store(
rep.set_filename(filename);
string txt = "<html><body>"+
"<a href=\"" + StripApplication.opt_replace_link + "/" +
- file_id + "/" + this.created_dir + "/"+chksum+"/"+ GLib.Uri.escape_string( filename) +"\">" +
- GLib.Uri.escape_string( filename) + // fixme needs html escaping...
+ file_id + "/" + this.created_dir + "/"+chksum+"/"+ GLib.Uri.escape_string( filename, "", false) +"\">" +
+ GLib.Uri.escape_string( filename, "", false) + // fixme needs html escaping...
"</a>" +
"</body></html>";
rep.get_content_type().set_parameter("charset", "utf-8");
rep.set_header("X-strip-id", file_id);
rep.set_header("X-strip-content-name", filename);
- rep.set_header("X-strip-path", this.created_dir + "/" + file_id + "-" + filename);
+ rep.set_header("X-strip-path", this.created_dir + "/" + file_id + "-" + GLib.Uri.escape_string(filename,"", false));
rep.set_header("X-strip-content-type", mime_type);
var stream = new GMime.StreamMem.with_buffer(txt.data);
var con = new GMime.DataWrapper.with_stream(stream,GMime.ContentEncoding.DEFAULT);