discard bodies with only quotes as empty
parent
4b55d702c5
commit
ea10f0e350
|
@ -31,6 +31,7 @@ import tempfile
|
||||||
import urwid
|
import urwid
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
try:
|
try:
|
||||||
port_spec = argv.index("--port")
|
port_spec = argv.index("--port")
|
||||||
|
@ -1199,9 +1200,11 @@ class ExternalEditor(urwid.Terminal):
|
||||||
if self.terminated:
|
if self.terminated:
|
||||||
app.close_editor()
|
app.close_editor()
|
||||||
with open(self.path) as _:
|
with open(self.path) as _:
|
||||||
self.params.update({"body": _.read().strip()})
|
body = _.read().strip()
|
||||||
os.remove(self.path)
|
os.remove(self.path)
|
||||||
if self.params["body"]:
|
|
||||||
|
if body and not re.search("^>>[0-9]+$", body):
|
||||||
|
self.params.update({"body": body})
|
||||||
network.request(self.endpoint, **self.params)
|
network.request(self.endpoint, **self.params)
|
||||||
return app.refresh(True)
|
return app.refresh(True)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue