mirror of
https://github.com/azaion/satellite-provider.git
synced 2026-04-22 09:06:38 +00:00
folders inside zip file
This commit is contained in:
@@ -701,6 +701,9 @@ public class RouteProcessingService : BackgroundService
|
||||
int addedFiles = 0;
|
||||
int missingFiles = 0;
|
||||
|
||||
var tilesBasePath = _storageConfig.TilesDirectory;
|
||||
var normalizedBasePath = Path.GetFullPath(tilesBasePath).TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
|
||||
|
||||
foreach (var tile in tiles)
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
@@ -710,8 +713,20 @@ public class RouteProcessingService : BackgroundService
|
||||
{
|
||||
try
|
||||
{
|
||||
var fileName = Path.GetFileName(tile.FilePath);
|
||||
zipArchive.CreateEntryFromFile(tile.FilePath, fileName, CompressionLevel.Optimal);
|
||||
var fullPath = Path.GetFullPath(tile.FilePath);
|
||||
string entryName;
|
||||
|
||||
if (fullPath.StartsWith(normalizedBasePath, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
entryName = fullPath.Substring(normalizedBasePath.Length + 1);
|
||||
entryName = entryName.Replace(Path.DirectorySeparatorChar, '/');
|
||||
}
|
||||
else
|
||||
{
|
||||
entryName = Path.GetFileName(tile.FilePath);
|
||||
}
|
||||
|
||||
zipArchive.CreateEntryFromFile(tile.FilePath, entryName, CompressionLevel.Optimal);
|
||||
addedFiles++;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user