feat(): Criado função que sanitiza nomes de arquivos
This commit is contained in:
parent
5d37a3d2a1
commit
45ff996b7f
2 changed files with 4 additions and 2 deletions
|
|
@ -76,7 +76,8 @@ class SaveMultipleRepository:
|
||||||
unique_id = uuid.uuid4().hex[:8]
|
unique_id = uuid.uuid4().hex[:8]
|
||||||
file_name = f"documento_{timestamp}_{unique_id}.pdf"
|
file_name = f"documento_{timestamp}_{unique_id}.pdf"
|
||||||
else:
|
else:
|
||||||
file_name = sanitize_filename(doc_schema.nome_documento)
|
raw_filename = doc_schema.nome_documento
|
||||||
|
file_name = sanitize_filename(raw_filename)
|
||||||
|
|
||||||
# Salva o arquivo físico
|
# Salva o arquivo físico
|
||||||
file_url_path = save_file_from_base64(
|
file_url_path = save_file_from_base64(
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,8 @@ class SaveMultipleRepository:
|
||||||
unique_id = uuid.uuid4().hex[:8] # reduzido para ficar mais limpo
|
unique_id = uuid.uuid4().hex[:8] # reduzido para ficar mais limpo
|
||||||
file_name = f"documento_{timestamp}_{unique_id}{file_ext}"
|
file_name = f"documento_{timestamp}_{unique_id}{file_ext}"
|
||||||
else:
|
else:
|
||||||
file_name = sanitize_filename(doc.nome_documento)
|
raw_filename = doc.nome_documento
|
||||||
|
file_name = sanitize_filename(raw_filename)
|
||||||
|
|
||||||
file_url_path = save_file_from_base64(
|
file_url_path = save_file_from_base64(
|
||||||
base64_content, file_name, new_ato_id, UPLOAD_DIR, GROUP_SIZE
|
base64_content, file_name, new_ato_id, UPLOAD_DIR, GROUP_SIZE
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue