Merge branch 'pr323'
This commit is contained in:
commit
995d3f546a
|
@ -3,6 +3,8 @@ from __future__ import print_function
|
||||||
import hashlib
|
import hashlib
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import stat
|
||||||
import tempfile
|
import tempfile
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
|
@ -364,6 +366,22 @@ class Sender:
|
||||||
file=args.stderr)
|
file=args.stderr)
|
||||||
return offer, fd_to_send
|
return offer, fd_to_send
|
||||||
|
|
||||||
|
if stat.S_ISBLK(os.stat(what).st_mode):
|
||||||
|
fd_to_send = open(what, "rb")
|
||||||
|
filesize = fd_to_send.seek(0, 2)
|
||||||
|
|
||||||
|
offer["file"] = {
|
||||||
|
"filename": basename,
|
||||||
|
"filesize": filesize,
|
||||||
|
}
|
||||||
|
print(
|
||||||
|
u"Sending %s block device named '%s'" % (naturalsize(filesize),
|
||||||
|
basename),
|
||||||
|
file=args.stderr)
|
||||||
|
|
||||||
|
fd_to_send.seek(0)
|
||||||
|
return offer, fd_to_send
|
||||||
|
|
||||||
raise TypeError("'%s' is neither file nor directory" % args.what)
|
raise TypeError("'%s' is neither file nor directory" % args.what)
|
||||||
|
|
||||||
@inlineCallbacks
|
@inlineCallbacks
|
||||||
|
|
Loading…
Reference in New Issue
Block a user