Skip to content

Commit dd67ec8

Browse files
committed
chore(volumes): clients empty content verify
1 parent 722b4a1 commit dd67ec8

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

rootfs/api/views.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,10 @@ def get_client(self):
867867
def list(self, request, **kwargs):
868868
path = request.query_params.get('path', '')
869869
client = self.get_client()
870-
results = client.get(path, params={"action": "list"}).json()
870+
response = client.get(path, params={"action": "list"})
871+
if response.status_code != 200:
872+
raise DryccException(response.text.replace("\n", ""))
873+
results = response.json()
871874
# fake out pagination for now
872875
pagination = {'results': results, 'count': len(results)}
873876
return Response(data=pagination)
@@ -877,6 +880,8 @@ def retrieve(self, request, **kwargs):
877880
client = self.get_client()
878881
chunk_size = 1024 * 1024 * 2
879882
response = client.get(path, stream=True, params={"action": "get"})
883+
if response.status_code != 200:
884+
raise DryccException(response.text.replace("\n", ""))
880885
return FileResponse(
881886
status=response.status_code,
882887
headers=response.headers,

0 commit comments

Comments
 (0)