ZIP: только PDF/Word, остальные пропускать, v1.5
This commit is contained in:
@@ -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')",
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
<body>
|
||||
<div class="topbar">
|
||||
<img src="{{ url_for('static', filename='nubes-logo.svg') }}" alt="Nubes">
|
||||
<span class="title">Сверка договоров <span style="font-weight:400;color:var(--muted);font-size:12px;">v1.4</span></span>
|
||||
<span class="title">Сверка договоров <span style="font-weight:400;color:var(--muted);font-size:12px;">v1.5</span></span>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user