Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mitigate noise from py-ipfs-api due to its mis-handling of 0-length payloads per #485 #572

Merged
merged 2 commits into from
Sep 25, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion ipwb/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ def pushToIPFS(hstr, payload):
if isinstance(payload, str):
payload = s2b(payload)

if len(payload) == 0: # py-ipfs-api issue #137
return

httpHeaderIPFSHash = pushBytesToIPFS(hstr)
payloadIPFSHash = pushBytesToIPFS(payload)

Expand Down Expand Up @@ -376,7 +379,13 @@ def pushBytesToIPFS(bytes):
global IPFS_API

# Returns unicode in py2.7, str in py3.7
res = IPFS_API.add_bytes(bytes) # bytes)
try:
res = IPFS_API.add_bytes(bytes) # bytes)
except TypeError as err:
logError('IPFS_API had an issue pushing the item to IPFS')
logError(sys.exc_info())
logError(len(bytes))
traceback.print_tb(sys.exc_info()[-1])

# TODO: verify that the add was successful

Expand Down