def test_send_file_inline(app): with app.test_request_context(): resp = send_file_inline(data_file("example-balances.csv")) assert (resp.headers["Content-Disposition"] == "inline; filename*=UTF-8''example-balances.csv") resp = send_file_inline(data_file("example-utf8-🦁.txt")) # pylint: disable=line-too-long assert (resp.headers["Content-Disposition"] == "inline; filename*=UTF-8''example-utf8-%F0%9F%A6%81.txt")
def test_send_file_inline(app): with app.test_request_context(): app.preprocess_request() resp = send_file_inline(data_file('example-balances.csv')) assert resp.headers['Content-Disposition'] == \ 'inline; filename*=UTF-8\'\'example-balances.csv' resp = send_file_inline(data_file('example-utf8-🦁.txt')) # pylint: disable=line-too-long assert resp.headers['Content-Disposition'] == \ 'inline; filename*=UTF-8\'\'example-utf8-%F0%9F%A6%81.txt'
def document(): """Download a document.""" filename = request.args.get("filename") filenames = [ document.filename for document in g.ledger.all_entries_by_type[Document] ] import_directories = [ g.ledger.join_path(d) for d in g.ledger.fava_options["import-dirs"] ] if filename in filenames: return send_file_inline(filename) if any(filename.startswith(d) for d in import_directories): return send_file_inline(filename) return abort(404)
def document(): """Download a document.""" filename = request.args.get('filename') if not any((filename == document.filename for document in g.ledger.all_entries_by_type[Document])): abort(404) return send_file_inline(filename)
def document() -> Response: """Download a document.""" filename = request.args.get("filename") if filename is None: return abort(404) if is_document_or_import_file(filename, g.ledger): return send_file_inline(filename) return abort(404)
def statement(): """Download a statement file.""" entry_hash = request.args.get("entry_hash") key = request.args.get("key") document_path = g.ledger.statement_path(entry_hash, key) return send_file_inline(document_path)
def statement(): """Download a statement file.""" entry_hash = request.args.get('entry_hash') key = request.args.get('key') document_path = g.ledger.statement_path(entry_hash, key) return send_file_inline(document_path)