From 5f0c806dc72d0da0f37fcec81a8112bb5a2a9cc4 Mon Sep 17 00:00:00 2001 From: Robin Beer Date: Mon, 19 Aug 2024 12:20:47 +0100 Subject: [PATCH] refactor(Entity.java): Updated zip sub directory file name check Replaced endsWith with equals to avoid unwanted matches e.g. stop_areas.txt being used instead of areas.txt --- src/main/java/com/conveyal/gtfs/model/Entity.java | 2 +- src/test/java/com/conveyal/gtfs/GTFSTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/conveyal/gtfs/model/Entity.java b/src/main/java/com/conveyal/gtfs/model/Entity.java index b4ada462..c6810ea2 100644 --- a/src/main/java/com/conveyal/gtfs/model/Entity.java +++ b/src/main/java/com/conveyal/gtfs/model/Entity.java @@ -288,7 +288,7 @@ public void loadTable(ZipFile zip) throws IOException { // check if table is contained within sub-directory while (entries.hasMoreElements()) { ZipEntry e = entries.nextElement(); - if (e.getName().endsWith(tableName + ".txt")) { + if (e.getName().equals(tableName + ".txt")) { entry = e; feed.errors.add(new TableInSubdirectoryError(tableName, entry.getName().replace(tableName + ".txt", ""))); } diff --git a/src/test/java/com/conveyal/gtfs/GTFSTest.java b/src/test/java/com/conveyal/gtfs/GTFSTest.java index 20c2f7c6..3da9a884 100644 --- a/src/test/java/com/conveyal/gtfs/GTFSTest.java +++ b/src/test/java/com/conveyal/gtfs/GTFSTest.java @@ -344,7 +344,7 @@ void canLoadAndExportFaresV2Feed() throws IOException { } /** - * Persistence expectations for use with the GTFS contained within the "MBTA_GTFS_Fares_v2.zip" feed. + * Persistence expectations for use with the GTFS contained within the "fake-agency-with-fares-v2" feed. */ private final PersistenceExpectation[] faresV2PersistenceExpectations = new PersistenceExpectation[]{ new PersistenceExpectation(