0

I am converting the s3 video to hls, in that case if the s3 file name has a space or bracket, it will converted into "+", so if the code search with the "+" in s3 bucket it didn't get object.


def handler(event, context):

    assetID = str(uuid.uuid4())
    sourceS3Bucket = event['Records'][0]['s3']['bucket']['name']
    sourceS3Key = event['Records'][0]['s3']['object']['key']
    sourceS3 = 's3://'+ sourceS3Bucket + '/' + sourceS3Key
    sourceS3Basename = os.path.splitext(os.path.basename(sourceS3))[0]
    

My S3 URI is :

s3://bucket_4999/ne gi.mp4

But in lambda i get it as s3://bucket_4999/ne+gi.mp4

So in AWS Elemental MediaConvert, i get the error as

Unable to open input file [s3://bucket_4999/ne+gi.mp4]: [Failed probe/open: [Can't read input stream: [Failed to read data: HeadObject failed]]]
Venkatesh
  • 58
  • 8
  • You should *really* avoid such keys, they will always cause problems. – luk2302 Dec 10 '22 at 17:11
  • 2
    The [key value is URL encoded](https://docs.aws.amazon.com/AmazonS3/latest/userguide/notification-content-structure.html) in the notification. To decode it, use [`urllib.parse.unquote_plus`](https://docs.python.org/3/library/urllib.parse.html#urllib.parse.unquote_plus) – Anon Coward Dec 10 '22 at 17:22

0 Answers0