Skip to content

Conversation

DenisaCG
Copy link
Member

@DenisaCG DenisaCG commented Nov 19, 2024

This PR adds the logic to list the contents of a drive and retrieve the contents of an individual file.

In order to properly deal with all types of content, the extension also retrieves all the registered JupyterLab file types and their corresponding formats and mimetypes. For certain files media types, the content is decoded differently in the backend.

@DenisaCG DenisaCG added the enhancement New feature or request label Nov 19, 2024
@DenisaCG DenisaCG self-assigned this Nov 19, 2024
Copy link

Binder 👈 Launch a Binder on branch DenisaCG/jupyter-drives/getContents

src/requests.ts Outdated

if (response.data) {
// listing the contents of a directory
if (options.path.indexOf('.') === -1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is no . character in the given path ... do the following.

Could you please clarify this? I'm not sure I understand why the . matters?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check is supposed to be for whether the given path corresponds to a directory or a file. I pushed a commit to better reflect this:

const isDir: boolean = PathExt.extname(options.path) === '';

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to check if it has children, instead? Because there could be directories with . in the name, right? The filesystem (and S3 I imagine) allow for this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, in every git repo, there is a root directory called .git

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point! I pushed a commit which updates the logic to check in the backend whether we are dealing with a directory or a file. The problem gets more complex when dealing with empty files or directories, so we will have to come back to this.

@DenisaCG
Copy link
Member Author

Going ahead and merging this. We can come back with a follow up PR to improve the logic for listing directories.

@DenisaCG DenisaCG merged commit 760d10e into QuantStack:main Nov 25, 2024
6 checks passed
@DenisaCG DenisaCG deleted the getContents branch November 25, 2024 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants