fts (2)
This commit is contained in:
@@ -338,6 +338,12 @@ def main() -> int:
|
||||
for filename in ('index-excluded.txt','index-excluded.xlsx','index-excluded.ods','forecast.csv','readme.txt'):
|
||||
result=http(query_path("/api/documents", {"q":filename,"scope":"name"}), token=user_token).json()
|
||||
check(result["total"] == 1 and result["items"][0]["snippet"] == '', "excluded file cannot be found by name or exposes text")
|
||||
for scope in ('name','all','content'):
|
||||
for query in ('Thumbs','Locked','IGNOREDARTIFACT742'):
|
||||
check(http(query_path("/api/documents", {"q":query,"scope":scope}), token=user_token).json()["total"] == 0,
|
||||
"cache or Office lock file appears in document search")
|
||||
catalog_artifacts=engine_run("exec", FILES_CONTAINER, "python3", "-c", "import sqlite3; c=sqlite3.connect('/state/documents/search.db'); print(c.execute(\"SELECT count(*) FROM documents WHERE lower(name)='thumbs.db' OR name GLOB '~$*'\").fetchone()[0])").stdout.strip()
|
||||
check(catalog_artifacts == '0', "cache or Office lock file reaches the document queue")
|
||||
# Guessing an indexed ID is insufficient to get another user's content.
|
||||
hidden_id = engine_run("exec", FILES_CONTAINER, "python3", "-c", "import sqlite3; c=sqlite3.connect('/state/documents/search.db'); print(c.execute(\"SELECT id FROM documents WHERE source_id='private:bob' AND name='readme.docx'\").fetchone()[0])").stdout.strip()
|
||||
for suffix in ("", "/preview", "/download", "/content"):
|
||||
|
||||
@@ -50,6 +50,9 @@ font=next(Path('/usr/share/fonts').rglob('NimbusSans-Regular.otf'))
|
||||
draw=ImageDraw.Draw(image)
|
||||
draw.text((120,200),'INVOICE SCAN\nCustomer reference SCANNEDUNIQUE742\nInvoice total 1500 EUR\nPayment due 30 October 2026',fill='black',font=ImageFont.truetype(str(font),44),spacing=40)
|
||||
image.save(root/'scanned-invoice.pdf','PDF',resolution=150)
|
||||
for folder in (root,Path('/data/private/alice')):
|
||||
for name in ('Thumbs.db','THUMBS.DB','~$Locked.docx','~$Locked.pptx'):
|
||||
(folder/name).write_text('IGNOREDARTIFACT742')
|
||||
(root/'index-excluded.txt').write_text('TEXTONLY742 should never be content-indexed')
|
||||
for suffix,entry in [('xlsx','xl/sharedStrings.xml'),('ods','content.xml')]:
|
||||
with zipfile.ZipFile(root/('index-excluded.'+suffix),'w') as spreadsheet:
|
||||
|
||||
Reference in New Issue
Block a user