From 435f617a2528f6a5607f69bca9faff6c4d75fdef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Tue, 16 Jun 2026 14:59:19 +0400 Subject: [PATCH] =?UTF-8?q?ZIP:=20=D1=82=D0=BE=D0=BB=D1=8C=D0=BA=D0=BE=20P?= =?UTF-8?q?DF/Word,=20=D0=BE=D1=81=D1=82=D0=B0=D0=BB=D1=8C=D0=BD=D1=8B?= =?UTF-8?q?=D0=B5=20=D0=BF=D1=80=D0=BE=D0=BF=D1=83=D1=81=D0=BA=D0=B0=D1=82?= =?UTF-8?q?=D1=8C,=20v1.5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site/app.py | 8 ++++++++ site/templates/upload.html | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/site/app.py b/site/app.py index 8c29b20..59a5bfe 100644 --- a/site/app.py +++ b/site/app.py @@ -178,6 +178,14 @@ class ContractsApp: zdata = zf.read(zname) zmime = mimeutil.guess_mime(zname) or "application/octet-stream" + # Только PDF и Word + if zmime not in ( + "application/pdf", + "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + "application/msword", + ): + continue + # Сохранить как отдельный документ db.execute( "INSERT INTO documents (filename, mime_type, original_bytes, status) VALUES (%s,%s,%s,'uploaded')", diff --git a/site/templates/upload.html b/site/templates/upload.html index 49e809f..767d260 100644 --- a/site/templates/upload.html +++ b/site/templates/upload.html @@ -47,7 +47,7 @@
Nubes - Сверка договоров v1.4 + Сверка договоров v1.5
@@ -150,6 +150,8 @@ var zip = await JSZip.loadAsync(f); zip.forEach(function(relativePath, zipEntry) { if (!zipEntry.dir) { + var ext = relativePath.toLowerCase().split('.').pop(); + if (['docx','doc','pdf'].indexOf(ext) === -1) return; fileQueue.push({ name: relativePath, lastModified: zipEntry.date ? zipEntry.date.getTime() : 0,