Repository navigation
Accept uploaded data files for notebook import - #14
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-importsdirectly 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-Lengthand 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
PUTalso takes a client-chosenidandDELETE /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.