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

Add search option #131

Merged
merged 12 commits into from
Oct 30, 2024
Merged

Add search option #131

merged 12 commits into from
Oct 30, 2024

Conversation

orenc17
Copy link
Contributor

@orenc17 orenc17 commented Oct 10, 2024

No description provided.

app.py Outdated Show resolved Hide resolved
app.py Outdated Show resolved Hide resolved
app.py Show resolved Hide resolved
@orenc17
Copy link
Contributor Author

orenc17 commented Oct 13, 2024

Hope my fix helps

@orenc17 orenc17 requested a review from romanzdk October 13, 2024 14:27
@romanzdk
Copy link
Owner

Unfortunately that did not fix the issue. The error happens on line 139 in view_bucket function throwing an botocore.exceptions.ClientError: An error occurred (InvalidArgument) when calling the ListObjectsV2 operation: The continuation token provided is incorrect error.

@orenc17
Copy link
Contributor Author

orenc17 commented Oct 13, 2024

can you give me some test credentials? so i could test on my end

@romanzdk
Copy link
Owner

Not really sure. I have simple aws root account with 2 random buckets, eu-central-1 region, everything default, few text files in the buckets. I think the issue is with the marker = ''.. Maybe the first request should not send any marker at all but that's pure guessing.

@orenc17
Copy link
Contributor Author

orenc17 commented Oct 13, 2024

Can you change the original marker value to None and check?

@romanzdk
Copy link
Owner

So marker=None did not work because a string is expected. I had to (ugly) hack the first request to not use the continuation token at all. Something like

if not marker:
                response = s3_client.list_objects_v2(Bucket=bucket_name,
                                                 Prefix=path,
                                                 Delimiter="/",
                                                 )
            else:    
                response = s3_client.list_objects_v2(Bucket=bucket_name,
                                                 Prefix=path,
                                                 Delimiter="/",
                                                 ContinuationToken=marker)

worked for me. However, when I submit the search I get the same error again. The same issue probably.

@romanzdk
Copy link
Owner

Please mention this new feature also in the README

@orenc17 orenc17 requested a review from romanzdk October 14, 2024 13:58
@romanzdk
Copy link
Owner

Now it fails again on view bucket. The error is on the newly added line that converts list of dicts to set and to list again. Dict is unhashable. Please test the changes before push.

@orenc17 orenc17 requested a review from romanzdk October 19, 2024 15:23
@romanzdk
Copy link
Owner

still an error on view bucket...

File "/Users/romanzdk/Repos/s3-browser/app.py", line 163, in view_bucket
    contents = parse_responses(responses, s3_client, bucket_name, search_param)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/romanzdk/Repos/s3-browser/app.py", line 59, in parse_responses
    S3Entry({
TypeError: S3Entry.__init__() missing 1 required positional argument: 'type'

@romanzdk romanzdk merged commit cf46332 into romanzdk:main Oct 30, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants