Skip to content

Commit

Permalink
Merge pull request #103 from oceanprotocol/ipfs-changes
Browse files Browse the repository at this point in the history
Always sending the getlink response to the client
  • Loading branch information
jamiehewitt15 authored Nov 6, 2023
2 parents 185c4a0 + 1906572 commit c83dc12
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions server/oceandbs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,8 @@ def get(self, request):
if response.status_code != 200:
return Response(json.loads(response.content), status=400)

print("Sending response:", response.content)

if quote.storage.type == "arweave":
# TODO: improve that by managing the different link format from different services.
responseObj = json.loads(response.content)
Expand All @@ -666,6 +668,15 @@ def get(self, request):
"type": quote.storage.type,
"CID": json.loads(response.content)[0]['CID']
})
else:
try:
# Attempt to parse the response content as JSON
responseObj = json.loads(response.content)
return Response(responseObj, status=response.status_code)
except json.JSONDecodeError:
# If response.content is not valid JSON, return it as is
return Response(response.content, status=response.status_code)


class QuoteHistory(APIView):
@csrf_exempt
Expand Down

0 comments on commit c83dc12

Please sign in to comment.