]> git.cworth.org Git - sup/blobdiff - lib/sup/draft.rb
Merge branch 'better-buffer-list' into next
[sup] / lib / sup / draft.rb
index 81c00445f764278ae5e298862c7ca9d567bcce2b..35fac30ee8cc0915632958abb6579c6ede54ebfa 100644 (file)
@@ -32,7 +32,10 @@ class DraftManager
 
   def discard m
     docid, entry = Index.load_entry_for_id m.id
-    raise ArgumentError, "can't find entry for draft: #{m.id.inspect}" unless entry
+    unless entry
+      Redwood::log "can't find entry for draft: #{m.id.inspect}. You probably already discarded it."
+      return
+    end
     raise ArgumentError, "not a draft: source id #{entry[:source_id].inspect}, should be #{DraftManager.source_id.inspect} for #{m.id.inspect} / docno #{docid}" unless entry[:source_id].to_i == DraftManager.source_id
     Index.drop_entry docid
     File.delete @source.fn_for_offset(entry[:source_info])
@@ -106,7 +109,7 @@ class DraftLoader < Source
   end
 
   def raw_message offset
-    IO.readlines(fn_for_offset(offset)).join
+    IO.read(fn_for_offset(offset))
   end
 
   def start_offset; 0; end