label-studio
label-studio copied to clipboard
Unable to load pre-signed s3 urls
Describe the bug
I am encountering an issue where Label Studio is unable to load pre-signed URLs for images stored in an Amazon S3 bucket. While the S3 bucket and permissions are correctly set up (I can directly access the images via the browser using the generated pre-signed URLs), Label Studio fails to load these images, displaying an error related to URL encoding.
To Reproduce Steps to reproduce the behavior:
1. Generate a pre-signed URL from an AWS S3 bucket.
2. Attempt to load the image in Label Studio via a task that contains the S3 URL in the image field.
3. Label Studio fails to load the image and seems to incorrectly re-encode or modify the URL, resulting in a “There was an issue loading URL from $image value” error.
Expected behavior The pre-signed URL should be passed to Label Studio without any re-encoding or modification, allowing the image to load successfully from S3.
Screenshots Here’s a comparison of the URL before and after Label Studio’s processing:
• Original URL:
https://s3.amazonaws.com/BUCKET/invoices/20/images/page_2.png?AWSAccessKeyId=XXX&Signature=%2FiMO25wi%2Fyx85f%2BPdHUuintYKpA%3D&Expires=1728212955
• Processed (incorrect) URL:
https://s3.amazonaws.com/BUCKET/invoices/20/images/page_2.png?AWSAccessKeyId=XXXXXX&Signature=%252FiMO25wi%252Fyx85f%252BPdHUuintYKpA%253D&Expires=1728212955
Environment (please complete the following information):
• OS: MacOS Sonoma 14.5
• Label Studio Version: heartexlabs/label-studio:latest
Additional context It seems Label Studio is re-encoding parts of the URL (such as the %2F being encoded to %252F), which causes the pre-signed URL signature to break. This results in an invalid signature and prevents the image from being loaded.
My bucket is configured correctly, and the images are accessible when I manually use the pre-signed URLs. This issue only occurs when the URLs are loaded through Label Studio.