v1.0.178: zip_source — БД, Python, JS. Дедупликация по паре (zip_source, name). addZipFile передаёт имя архива.
This commit is contained in:
@@ -59,6 +59,13 @@ def handle_upload(rfile, content_type, content_length):
|
||||
except (ValueError, AttributeError):
|
||||
batch_id = None
|
||||
|
||||
# zip_source — имя родительского ZIP-архива (для визуальной группировки)
|
||||
zip_source = None
|
||||
if "zip_source" in fs:
|
||||
raw_zip = fs.getfirst("zip_source", "")
|
||||
if raw_zip:
|
||||
zip_source = os.path.basename(raw_zip)[:255] # защита от path traversal + лимит
|
||||
|
||||
if not filename or not file_data:
|
||||
return {"ok": False, "error": "no file in request"}
|
||||
|
||||
@@ -71,7 +78,7 @@ def handle_upload(rfile, content_type, content_length):
|
||||
except Exception:
|
||||
pass # old record may not exist or FK issue — proceed with insert
|
||||
|
||||
doc = documents.insert(filename, mime, b64, batch_id=batch_id)
|
||||
doc = documents.insert(filename, mime, b64, batch_id=batch_id, zip_source=zip_source)
|
||||
|
||||
if not contract_id:
|
||||
from datetime import datetime
|
||||
|
||||
Reference in New Issue
Block a user