- log.msg('Sharing %s with %s' % (files[0]['path'].path, request.remoteAddr))
- return FileUploader(files[0]['path'].path), ()
+ # If it is a file, return it
+ if 'path' in files[0]:
+ log.msg('Sharing %s with %s' % (files[0]['path'].path, request.remoteAddr))
+ return FileUploader(files[0]['path'].path), ()
+ else:
+ # It's not for a file, but for a piece string, so return that
+ log.msg('Sending torrent string %s to %s' % (b2a_hex(hash), request.remoteAddr))
+ return static.Data(bencode({'t': files[0]['pieces']}), 'application/x-bencoded'), ()