diff --git a/Jellyfin.Plugin.ShareLinks/Jellyfin.Plugin.ShareLinks.csproj b/Jellyfin.Plugin.ShareLinks/Jellyfin.Plugin.ShareLinks.csproj index 55b8641..99a717c 100644 --- a/Jellyfin.Plugin.ShareLinks/Jellyfin.Plugin.ShareLinks.csproj +++ b/Jellyfin.Plugin.ShareLinks/Jellyfin.Plugin.ShareLinks.csproj @@ -6,9 +6,9 @@ latest Jellyfin.Plugin.ShareLinks Jellyfin.Plugin.ShareLinks - 1.0.6.0 - 1.0.6.0 - 1.0.6.0 + 1.0.7.0 + 1.0.7.0 + 1.0.7.0 true false disable diff --git a/Jellyfin.Plugin.ShareLinks/Web/WebInjectionHostedService.cs b/Jellyfin.Plugin.ShareLinks/Web/WebInjectionHostedService.cs index d65741f..5de63a1 100644 --- a/Jellyfin.Plugin.ShareLinks/Web/WebInjectionHostedService.cs +++ b/Jellyfin.Plugin.ShareLinks/Web/WebInjectionHostedService.cs @@ -70,11 +70,7 @@ public sealed class WebInjectionHostedService : IHostedService return; } - var backup = path + ".sharelinks.bak"; - if (!File.Exists(backup)) - { - File.Copy(path, backup); - } + TryBackup(path, path + ".sharelinks.bak"); var snippet = "\n" + Begin + "\n\n" + End + "\n"; var bodyIndex = html.LastIndexOf("", StringComparison.OrdinalIgnoreCase); @@ -84,4 +80,21 @@ public sealed class WebInjectionHostedService : IHostedService _logger.LogInformation("ShareLinks: injected client script into {Path}.", path); } + private void TryBackup(string path, string backup) + { + // The backup is only a convenience. Some images (linuxserver) make the + // web folder root-owned while index.html itself is writable, so a + // failed copy must not stop the injection. + try + { + if (!File.Exists(backup)) + { + File.Copy(path, backup); + } + } + catch (Exception ex) when (ex is UnauthorizedAccessException or IOException) + { + _logger.LogDebug(ex, "ShareLinks: could not back up {Path}, injecting without a backup.", path); + } + } } diff --git a/Jellyfin.Plugin.ShareLinks/meta.json b/Jellyfin.Plugin.ShareLinks/meta.json index 5b8b1a0..eedc354 100644 --- a/Jellyfin.Plugin.ShareLinks/meta.json +++ b/Jellyfin.Plugin.ShareLinks/meta.json @@ -1,12 +1,12 @@ { "guid": "68540b76-ee74-436d-85ff-2abc884bbea6", "name": "ShareLinks", - "version": "1.0.6.0", + "version": "1.0.7.0", "targetAbi": "10.11.0.0", "framework": "net9.0", "owner": "Franciskid", "overview": "Secure expiring guest-share links for Jellyfin items.", "description": "Adds secure, expiring share links for Jellyfin items with JSON-backed storage, token hashing, and cleanup scaffolding.", "category": "General", - "timestamp": "2026-09-18T12:00:00.0000000Z" + "timestamp": "2026-09-18T14:00:00.0000000Z" }