Skip to content

Commit

Permalink
Close files on error
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitfred committed Jan 20, 2025
1 parent d5cd80a commit 89dad4a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apps/transport/lib/registry/gtfs.ex
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ defmodule Transport.Registry.GTFS do
{:ok, unzip} ->
if has_stops?(unzip) do
content = unzip |> Unzip.file_stream!("stops.txt")
# The zip_file is kept open for now as it's consumed later.
Result.ok({content, zip_file})
else
Unzip.LocalFile.close(zip_file)
Result.error("Missing stops.txt in #{archive}")
end

Expand Down

0 comments on commit 89dad4a

Please sign in to comment.