Code Room
Code reviewMediumcr-g605
Subject Storage file ioLevel Mid–Senior~20 minCommon in Storage & CDN · Distributed systems interviewsIndustries Software development, Technology

Question

Review this Python file-upload handler.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewpython
import hashlib def upload_to_s3(s3, bucket, key, path):    with open(path, "rb") as f:        data = f.read()    digest = hashlib.sha256(data).hexdigest()    s3.put_object(        Bucket=bucket,        Key=key,        Body=data,        Metadata={"sha256": digest},    )    return digest def handle_upload(s3, bucket, request):    for upload in request.files:        # may be GB-sized video files        key = f"uploads/{upload.filename}"        upload_to_s3(s3, bucket, key, upload.tmp_path)
Run or narrate your approach, then ask the coach.