Skip to content

Commit

Permalink
Fix xml name without extrension (#75)
Browse files Browse the repository at this point in the history
* Update dependencies

* Run formatter

* Fix issue when pdf files without extension
  • Loading branch information
gabriel-piles authored May 9, 2023
1 parent 7499717 commit 72e6869
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ async def get_paragraphs(tenant: str, pdf_file_name: str):
@app.get("/get_xml/{tenant}/{pdf_file_name}", response_class=PlainTextResponse)
async def get_xml(tenant: str, pdf_file_name: str):
try:
xml_file_name = ".".join(pdf_file_name.split(".")[:-1]) + ".xml"
xml_file_name = pdf_file_name.replace(".", "") + ".xml"

with open(
f"{config.DATA_PATH}/xml/{tenant}/{xml_file_name}",
Expand Down
2 changes: 1 addition & 1 deletion src/extract_pdf_paragraphs/extract_paragraphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


def get_paths(tenant: str, pdf_file_name: str):
file_name = "".join(pdf_file_name.split(".")[:-1])
file_name = pdf_file_name.replace(".", "")
pdf_file_path = f"{config.DATA_PATH}/to_extract/{tenant}/{pdf_file_name}"
xml_file_path = f"{config.DATA_PATH}/xml/{tenant}/{file_name}.xml"
failed_pdf_path = f"{config.DATA_PATH}/failed_pdf/{tenant}/{pdf_file_name}"
Expand Down

0 comments on commit 72e6869

Please sign in to comment.