fix: фильтрация macOS ._файлов и __MACOSX при извлечении zip
._ЛС-01-02-4-00-01 ВСП.xlsx — macOS resource fork, не настоящий xlsx. Claude пытался его прочитать → верификация фейлила. Теперь: не извлекаем ._ и __MACOSX из архива вообще. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -130,10 +130,14 @@ def extract_zip(zip_path: str, dest_dir: str) -> list[str]:
|
||||
info.filename = fixed
|
||||
except (UnicodeDecodeError, UnicodeEncodeError):
|
||||
pass # keep original if re-decode fails
|
||||
# Skip macOS resource fork files and __MACOSX directory
|
||||
basename = Path(info.filename).name
|
||||
if basename.startswith('._') or '__MACOSX' in info.filename:
|
||||
continue
|
||||
z.extract(info, dest_dir)
|
||||
files = []
|
||||
for f in Path(dest_dir).rglob('*.xlsx'):
|
||||
if not f.name.startswith('~$'):
|
||||
if not f.name.startswith('~$') and not f.name.startswith('._'):
|
||||
files.append(str(f))
|
||||
return sorted(files)
|
||||
|
||||
|
||||
+13
-2
@@ -92,8 +92,19 @@ pre { background: #2c2c2c; color: #f5f0eb; padding: .8rem; border-radius: 6px; o
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const token = localStorage.getItem('token');
|
||||
if (!token) window.location.href = '/';
|
||||
let token = localStorage.getItem('token');
|
||||
if (!token) {
|
||||
// Quick inline login instead of redirect
|
||||
const u = prompt('Логин:');
|
||||
const p = prompt('Пароль:');
|
||||
if (u && p) {
|
||||
fetch('/api/login', {method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({username:u,password:p})})
|
||||
.then(r => r.json()).then(d => {
|
||||
if (d.token) { localStorage.setItem('token',d.token); token=d.token; location.reload(); }
|
||||
else { alert('Неверные данные'); window.location.href='/'; }
|
||||
}).catch(() => window.location.href='/');
|
||||
} else { window.location.href='/'; }
|
||||
}
|
||||
|
||||
const API = '/api/batch-v3';
|
||||
const H = {'Authorization': 'Bearer ' + token};
|
||||
|
||||
Reference in New Issue
Block a user