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

A trailing '/' in a file selector path raises a KeyError #204

Closed
g5t opened this issue Apr 23, 2024 · 0 comments · Fixed by #205
Closed

A trailing '/' in a file selector path raises a KeyError #204

g5t opened this issue Apr 23, 2024 · 0 comments · Fixed by #205
Labels
bug Something isn't working

Comments

@g5t
Copy link
Contributor

g5t commented Apr 23, 2024

Accessing a file via scippnexus with a relative or absolute path that ends in an extraneous '/' raises a KeyError due to attempting to access the empty path '' in the following code snippet

if '/' in sel:
if sel.startswith('/'):
return self.file[sel[1:]]
else:
grp, path = sel.split('/', 1)
return self[grp][path]

I expected the trailing forward slash to not raise an error; and for accessing, e.g., '/entry' and /entry/', to result in the same object.

Is there a reason that a trailing '/' should raise an error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants