Note sure how to remove the Upload widget/icon from JupyterLab

We are trying to prevent users from uploading data files and notebooks from their local file system or a shared network drive. We are building an extension that will allow users to upload data files and notebooks from a secured and curated Google Storage Bucket.

As such we would like to remove the upload icon/widget from JupyterLab. We are not sure how to accomplish that. Can someone please provide instructions or a hint how to accomplish that.

Thanks.

Be aware that just removing the icon does not prevent users from uploading using the server API. If you want security, you’ll need to have your own contents manager on the server side to refuse uploads via the api.

More directly about the UX, though: the upload button is hardcoded in the file browser (added at https://github.com/jupyterlab/jupyterlab/blob/ad0f1a5bc745a32086403cb89b98f33c09756e98/packages/filebrowser/src/browser.ts#L88). IIRC, you can also upload by dragging and dropping files onto the filebrowser. If you’d like to remove those features, you can either subclass the filebrowser, or you can contribute a PR upstream to make those optional in the filebrowser. You aren’t the first ones to want to restrict uploading, so such a PR would be welcome, I think.

1 Like

Jason:

Thank you for your reply.

We will create a pull request to make uploading an optional capability.

In the meanwhile, I have a follow-up question.

How can I go about testing a particular code change (e.g., such as modifying browser.ts) without having to do a complete rebuild of JupyterLab? Is it possible to just rebuild a specific NPM package and then copy it to the dev-mode directory and then do a "jupyter dev-mode …

In the dev docs, we document using the watch parameter: https://github.com/jupyterlab/jupyterlab/blob/ad0f1a5bc745a32086403cb89b98f33c09756e98/CONTRIBUTING.md#build-the-jupyterlab-server-extension

Jason:

Can you provide me with contact information for Saul Shanabrook and Sylvain Corlay.

I’ll DM you here and CC them on the DM.