Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: S3 "folder" key has no ending slash #10714

Open
1 task done
spring1915 opened this issue Apr 24, 2024 · 4 comments
Open
1 task done

bug: S3 "folder" key has no ending slash #10714

spring1915 opened this issue Apr 24, 2024 · 4 comments
Assignees
Labels
area: web app.localstack.cloud aws:s3 Amazon Simple Storage Service status: backlog Triaged but not yet being worked on type: bug Bug report

Comments

@spring1915
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

The results of listing S3 bucket objects don't contain a forward slash for "folder" objects. For instance, if a bucket contains "folders" abc, and def, then the result is

/abc/def
/abc/def/config.json

Expected Behavior

The ending slash for def.

/abc/def/
/abc/def/config.json

How are you starting LocalStack?

Custom (please describe below)

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

Start localstack with docker or localstack cli.

s3 = boto3.client('s3',
              endpoint_url="<http://localhost.localstack.cloud:4566>",
                region_name='us-east-1',
                aws_access_key_id="test",
                aws_secret_access_key="test",)
  paginator = s3.get_paginator('list_objects_v2')
  operation_parameters = {'Bucket': bucket_name, 'Prefix': prefix}

  for page in paginator.paginate(**operation_parameters):
      for obj in page['Contents']:
          key = obj['Key']

Environment

- OS: Mac
- LocalStack: 3.3.0

Anything else?

No response

@spring1915 spring1915 added status: triage needed Requires evaluation by maintainers type: bug Bug report labels Apr 24, 2024
@localstack-bot
Copy link
Collaborator

Welcome to LocalStack! Thanks for reporting your first issue and our team will be working towards fixing the issue for you or reach out for more background information. We recommend joining our Slack Community for real-time help and drop a message to LocalStack Pro Support if you are a Pro user! If you are willing to contribute towards fixing this issue, please have a look at our contributing guidelines and our contributing guide.

@bentsku
Copy link
Contributor

bentsku commented Apr 24, 2024

Hello @spring1915 and thanks for your report!

It's not clear what the issue is here. "Folder" objects are technically defined by yourself or the SDK, you would have to create them yourself.

Could you please share the commands done to create those particular folder keys? We should have pretty good parity with keys finishing with / or not.

I believe that if you create a key named /abc/def/, then the call to ListObjectsV2 should return /abc/def/.
The report does not share how those keys are created.

Thanks!

@bentsku bentsku added status: response required Waiting for a response from the reporter aws:s3 Amazon Simple Storage Service and removed status: triage needed Requires evaluation by maintainers labels Apr 24, 2024
@bentsku bentsku self-assigned this Apr 24, 2024
@spring1915
Copy link
Author

spring1915 commented Apr 25, 2024

Thanks @bentsku . I used the "Create Folder" button of Localstack Desktop to create a new folder.

It seems that I found a way to get it over. When hitting "Create Folder", a name ending with a slash must be included as the folder name. Making a folder without this character results in the missing of a slash when listing bucket objects, even although the folder is indicated as being successfully created.

@localstack-bot localstack-bot removed the status: response required Waiting for a response from the reporter label Apr 25, 2024
@bentsku
Copy link
Contributor

bentsku commented Apr 29, 2024

Hello @spring1915 and thanks for the quick feedback!

So to be sure, when in AWS S3 you'd create a "folder" key, it would come with a trailing slash. But with the same action with the LocalStack Desktop app, it does not. This looks like an issue in our application then and not S3. I will share this issue with the related team, and update you here. Thank you!

@bentsku bentsku added status: backlog Triaged but not yet being worked on area: web app.localstack.cloud labels Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: web app.localstack.cloud aws:s3 Amazon Simple Storage Service status: backlog Triaged but not yet being worked on type: bug Bug report
Projects
None yet
Development

No branches or pull requests

3 participants