Commit 2426c4ed authored by Martin Tvarožek's avatar Martin Tvarožek
Browse files

feat: use more robust path parsing during import

parent 100ff291
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@ using System.Text.Json.Serialization.Metadata;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using Avalonia.Controls;
using Avalonia.Platform.Storage;
using GarrigueGamesLauncher.Interfaces;
@@ -100,7 +99,13 @@ public class GameImporterService(
    /// <returns>True if the game was successfully imported; otherwise, false.</returns>
    private async Task<bool> ImportGameAsync(IStorageFile file)
    {
        var zipPath = HttpUtility.UrlDecode(file.Path.AbsolutePath);
        var zipPath = file.TryGetLocalPath();
        if (zipPath == null)
        {
            _ = EnqueueImportErrorMessage(file, $"Could not get local path for file {file.Path}");
            return false;
        }
        
        var targetPath = Path.Join(TempDirPath, Guid.NewGuid().ToString());
        
        var result = await Unzip(zipPath, targetPath);