From bf2030e3c675c00d4e57283edb760a254db274e9 Mon Sep 17 00:00:00 2001 From: Anton Martynenko Date: Thu, 20 Nov 2025 12:32:56 +0100 Subject: [PATCH] improved zip file --- .../ExtendedRouteTests.cs | 13 +++++++++---- .../RouteProcessingService.cs | 7 ++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/SatelliteProvider.IntegrationTests/ExtendedRouteTests.cs b/SatelliteProvider.IntegrationTests/ExtendedRouteTests.cs index b3eeeaa..8ac0c83 100644 --- a/SatelliteProvider.IntegrationTests/ExtendedRouteTests.cs +++ b/SatelliteProvider.IntegrationTests/ExtendedRouteTests.cs @@ -182,13 +182,18 @@ public static class ExtendedRouteTests Console.WriteLine($" - {path}"); } - var pathParts = firstEntry.FullName.Split('/'); - if (pathParts.Length < 4) + if (!firstEntry.FullName.StartsWith("tiles/")) { - throw new Exception($"Expected directory structure like '18/158/91/tile_xxx.jpg' but got '{firstEntry.FullName}'"); + throw new Exception($"Expected path to start with 'tiles/' but got '{firstEntry.FullName}'"); } - Console.WriteLine($" ✓ Directory structure preserved (zoom/{pathParts[0]}/x-bucket/{pathParts[1]}/y-bucket/{pathParts[2]}/file)"); + var pathParts = firstEntry.FullName.Split('/'); + if (pathParts.Length < 5) + { + throw new Exception($"Expected directory structure like 'tiles/18/158/91/tile_xxx.jpg' but got '{firstEntry.FullName}'"); + } + + Console.WriteLine($" ✓ Directory structure preserved ({pathParts[0]}/zoom/{pathParts[1]}/x-bucket/{pathParts[2]}/y-bucket/{pathParts[3]}/file)"); } Console.WriteLine(); diff --git a/SatelliteProvider.Services/RouteProcessingService.cs b/SatelliteProvider.Services/RouteProcessingService.cs index ef53f87..52dd8e4 100644 --- a/SatelliteProvider.Services/RouteProcessingService.cs +++ b/SatelliteProvider.Services/RouteProcessingService.cs @@ -718,12 +718,13 @@ public class RouteProcessingService : BackgroundService if (fullPath.StartsWith(normalizedBasePath, StringComparison.OrdinalIgnoreCase)) { - entryName = fullPath.Substring(normalizedBasePath.Length + 1); - entryName = entryName.Replace(Path.DirectorySeparatorChar, '/'); + var relativePath = fullPath.Substring(normalizedBasePath.Length + 1); + relativePath = relativePath.Replace(Path.DirectorySeparatorChar, '/'); + entryName = "tiles/" + relativePath; } else { - entryName = Path.GetFileName(tile.FilePath); + entryName = "tiles/" + Path.GetFileName(tile.FilePath); } zipArchive.CreateEntryFromFile(tile.FilePath, entryName, CompressionLevel.Optimal);