Compare commits
3 Commits
9bbd87ed36
...
089b14e6c9
Author | SHA1 | Date | |
---|---|---|---|
089b14e6c9 | |||
4a80d4097e | |||
a8f22fb741 |
@ -132,17 +132,44 @@ To allow for uploading large files reliably, Sachet requires that you upload fil
|
|||||||
Partial uploads do not affect the state of the share;
|
Partial uploads do not affect the state of the share;
|
||||||
a new file exists only once all chunks are uploaded.
|
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:
|
Every chunk has the following schema:
|
||||||
|
|
||||||
.. _files_chunk_schema :
|
.. _files_chunk_schema :
|
||||||
|
|
||||||
.. code-block:: json
|
.. code-block::
|
||||||
|
|
||||||
{
|
dztotalchunks = 3
|
||||||
"dztotalchunks": 3,
|
dzchunkindex = 2
|
||||||
"dzchunkindex": 2,
|
dzuuid = "unique_id"
|
||||||
"dzuuid": "unique_id"
|
upload = <binary data>
|
||||||
}
|
|
||||||
|
|
||||||
..
|
.. note::
|
||||||
TODO...
|
|
||||||
|
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.
|
||||||
|
@ -111,9 +111,7 @@ class FileContentAPI(MethodView):
|
|||||||
|
|
||||||
if upload.completed:
|
if upload.completed:
|
||||||
share.initialized = True
|
share.initialized = True
|
||||||
# really convoluted
|
db.session.delete(upload)
|
||||||
# but otherwise it doesn't cascade deletes?
|
|
||||||
Upload.query.filter(Upload.upload_id == upload.upload_id).delete()
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return jsonify(dict(status="success", message="Upload completed.")), 201
|
return jsonify(dict(status="success", message="Upload completed.")), 201
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user