mirror of
https://github.com/suitenumerique/drive.git
synced 2026-10-15 04:35:06 +02:00
Item creation now rejects a file without a reservation, so both session scenarios would fail at the upload step. The size is read from the file the scenario is about to send, keeping the generated traffic realistic.
12 lines
636 B
Groovy
12 lines
636 B
Groovy
// Splits the current upfile_N entry ("relative dir" + SEP + "absolute path"
|
|
// + SEP + "name", see plan_upload.groovy) and resolves the parent item id
|
|
// and mimetype for the file about to be uploaded.
|
|
def parts = vars.get("current_upfile").split("\u001F", 3)
|
|
def relDir = parts[0]
|
|
vars.put("cf_parent", relDir.isEmpty() ? vars.get("folder_id") : vars.get("upfid_" + relDir))
|
|
vars.put("cf_abs", parts[1])
|
|
vars.put("cf_size", String.valueOf(new File(vars.get("cf_abs")).length()))
|
|
vars.put("cf_name", parts[2])
|
|
def mime = java.net.URLConnection.guessContentTypeFromName(parts[2])
|
|
vars.put("cf_mime", mime ?: "application/octet-stream")
|