@@ -58,8 +58,9 @@ record TransportVersionDefinition(String name, List<TransportVersionId> ids) {
5858 }
5959
6060 public static TransportVersionDefinition fromString (String filename , String contents ) {
61- assert filename .endsWith (".csv" );
62- String name = filename .substring (0 , filename .length () - CSV_SUFFIX .length ());
61+ assert filename .endsWith (CSV_SUFFIX );
62+ String fileWithoutPath = Path .of (filename ).getFileName ().toString ();
63+ String name = fileWithoutPath .substring (0 , fileWithoutPath .length () - CSV_SUFFIX .length ());
6364 List <TransportVersionId > ids = new ArrayList <>();
6465
6566 if (contents .isEmpty () == false ) {
@@ -84,7 +85,8 @@ record TransportVersionLatest(String branch, String name, TransportVersionId id)
8485
8586 public static TransportVersionLatest fromString (String filename , String contents ) {
8687 assert filename .endsWith (".csv" );
87- String branch = filename .substring (0 , filename .length () - CSV_SUFFIX .length ());
88+ String fileWithoutPath = Path .of (filename ).getFileName ().toString ();
89+ String branch = fileWithoutPath .substring (0 , fileWithoutPath .length () - CSV_SUFFIX .length ());
8890
8991 String [] parts = contents .split ("," );
9092 if (parts .length != 2 ) {
@@ -203,13 +205,13 @@ static void validateNameFormat(String name) {
203205 }
204206
205207 static void validateBranchFormat (String branchName ) {
206- if (Pattern .compile ("^(\\ d\\ .\\ d)|SERVERLESS$" ).matcher (branchName ).matches () == false ) {
208+ if (Pattern .compile ("^(\\ d+ \\ .\\ d+ )|SERVERLESS$" ).matcher (branchName ).matches () == false ) {
207209 throw new GradleException ("The branch name must be of the form \" int.int\" or \" SERVERLESS\" " );
208210 }
209211 }
210212
211213 static List <TransportVersionReference > readReferencesFile (Path file ) throws IOException {
212- assert file .endsWith (".txt" );
214+ assert file .toString (). endsWith (".txt" );
213215 List <TransportVersionReference > results = new ArrayList <>();
214216 for (String line : Files .readAllLines (file , StandardCharsets .UTF_8 )) {
215217 String [] parts = line .split ("," , 2 );
0 commit comments