From 77d1463b7183aa658cc7da3610b795d462ab493f Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Tue, 27 Sep 2022 09:44:22 -0500 Subject: refactor resolve function --- src/slskd/Shares/SharedFileCache.cs | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'src/slskd/Shares/SharedFileCache.cs') diff --git a/src/slskd/Shares/SharedFileCache.cs b/src/slskd/Shares/SharedFileCache.cs index 6e6cc6e6..6ccea3fc 100644 --- a/src/slskd/Shares/SharedFileCache.cs +++ b/src/slskd/Shares/SharedFileCache.cs @@ -50,14 +50,6 @@ namespace slskd.Shares /// The operation context. Task FillAsync(IEnumerable shares, IEnumerable filters); - /// - /// Substitutes the mask in the specified with the original path, if the mask is tracked - /// by the cache. - /// - /// The fully qualified filename to unmask. - /// The unmasked filename. - string Resolve(string filename); - /// /// Searches the cache for the specified and returns the matching files. /// @@ -372,31 +364,6 @@ namespace slskd.Shares } } - /// - /// Substitutes the mask in the specified with the original path, if the mask is tracked - /// by the cache. - /// - /// The fully qualified filename to unmask. - /// The unmasked filename. - public string Resolve(string filename) - { - using var conn = GetConnection(); - using var cmd = new SqliteCommand("SELECT originalFilename FROM files WHERE maskedFilename = @maskedFilename;", conn); - cmd.Parameters.AddWithValue("maskedFilename", filename); - - var reader = cmd.ExecuteReader(); - - if (!reader.Read()) - { - Log.Warning("Failed to resolve shared file {Filename}", filename); - return null; - } - - var resolved = reader.GetString(0); - Log.Debug($"Resolved requested shared file {filename} to {resolved}"); - return resolved; - } - /// /// Searches the cache for the specified and returns the matching files. /// -- cgit v1.2.3