Skip to content

Accept uploaded data files for notebook import - #14

Merged
nicosuave merged 2 commits into
mainfrom
upload-endpoint
Nov 15, 2026
Merged

nicosuave merged 2 commits into
mainfrom
upload-endpoint

Conversation

@nicosuave

Copy link
Copy Markdown
Member

Adds an upload endpoint so the notebook UI can import a dropped CSV, Parquet or JSON file. A browser does not tell a page where a dropped file is stored, so the UI uploads a copy and imports it by path.

PUT /api/v1/import?name=<file name> streams the request body into .sqlnb-imports directly under the notebook root and returns the saved file's absolute path. DELETE /api/v1/import?name= removes one saved file. The bootstrap response advertises the endpoint, its 1 GiB limit and the folder; servers without the field have no upload endpoint.

Names are reduced to a safe base name with a data-file extension, an existing file is never replaced, and the folder and files are opened relative to the notebook root without following symlinks. The size limit is enforced from Content-Length and again while the body streams; bytes go to a temporary file that is renamed into place only after the whole body arrives, and a refused, failed or aborted upload removes it.

An aborted request cannot cancel an upload the server already received in full, so PUT also takes a client-chosen id and DELETE /api/v1/import?id= either deletes the saved file or makes the upload fail before it is saved. Both outcomes are decided under one lock.

The Rust tests and the macOS release build with its runtime smoke pass locally. The Windows implementation has not been built or run locally; this pull request's Windows workflow is its first check.

PUT /api/v1/import saves the request body under .sqlnb-imports in the
notebook root and returns its absolute path; DELETE removes one saved file.
Names are reduced to a safe base name with a data-file extension, existing
files are never replaced, symlinks are not followed, and the size limit
advertised in the bootstrap response is enforced while the body streams,
removing the partial file on failure or abort.
An aborted request cannot stop an upload the server has already received in
full and saved. PUT /api/v1/import takes an optional client-chosen id, and
DELETE /api/v1/import?id= deletes that upload's file if it was saved or makes
it fail before it is saved; both outcomes are decided under one lock.
@nicosuave
nicosuave merged commit 86e9ce9 into main Nov 15, 2026
8 of 9 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.

1 participant