Skip to content

Commit

Permalink
refactor: removing redundant code for removing extra closing </osm> t…
Browse files Browse the repository at this point in the history
…ag (#1264)

Co-authored-by: sujanadh <sujanadh07@gmail.com>
  • Loading branch information
Sujanadh and sujanadh authored Feb 23, 2024
1 parent 98fcf58 commit 0a3de42
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/backend/app/submissions/submission_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,21 +298,9 @@ async def get_osm_xml(
# Remove the extra closing </osm> tag from the end of the file
with open(osmoutfile, "r") as f:
osmoutfile_data = f.read()
# Find the last index of the closing </osm> tag
last_osm_index = osmoutfile_data.rfind("</osm>")
# Remove the extra closing </osm> tag from the end
processed_xml_string = (
osmoutfile_data[:last_osm_index]
+ osmoutfile_data[last_osm_index + len("</osm>") :]
)

# Write the modified XML data back to the file
with open(osmoutfile, "w") as f:
f.write(processed_xml_string)

# Create a plain XML response
response = Response(content=processed_xml_string, media_type="application/xml")
return response
return Response(content=osmoutfile_data, media_type="application/xml")


@router.get("/submission_page/{project_id}")
Expand Down

0 comments on commit 0a3de42

Please sign in to comment.