Compare commits

..

No commits in common. "089b14e6c9fecdeea2a6a95346723a3077fe0ace" and "9bbd87ed363fd78d1d67ea8cf423d39fb7e683d4" have entirely different histories.

2 changed files with 11 additions and 36 deletions

View File

@ -132,44 +132,17 @@ To allow for uploading large files reliably, Sachet requires that you upload fil
Partial uploads do not affect the state of the share;
a new file exists only once all chunks are uploaded.
Chunks are ordered by their index.
Once an upload finishes, they are combined in that order to form the new file.
The server will respond with ``200 OK`` when chunks are sent.
When the final chunk is sent, and the upload is completed,
the server will instead respond with ``201 Created``.
Every chunk has the following schema:
.. _files_chunk_schema :
.. code-block::
.. code-block:: json
dztotalchunks = 3
dzchunkindex = 2
dzuuid = "unique_id"
upload = <binary data>
{
"dztotalchunks": 3,
"dzchunkindex": 2,
"dzuuid": "unique_id"
}
.. note::
This data is sent via a ``multipart/form-data`` request; it's not JSON.
.. list-table::
:header-rows: 1
:widths: 25 25 50
* - Property
- Type
- Description
* - ``dztotalchunks``
- Integer
- Total number of chunks the client will send.
* - ``dzchunkindex``
- Integer
- Number of the chunk being sent.
* - ``dzuuid``
- String
- ID which is the same for all chunks in a single upload.
* - ``upload``
- Binary data (file)
- Data contained in this chunk.
..
TODO...

View File

@ -111,7 +111,9 @@ class FileContentAPI(MethodView):
if upload.completed:
share.initialized = True
db.session.delete(upload)
# really convoluted
# but otherwise it doesn't cascade deletes?
Upload.query.filter(Upload.upload_id == upload.upload_id).delete()
db.session.commit()
return jsonify(dict(status="success", message="Upload completed.")), 201
else: