From d88034c988c6465a9fb818d966fc6f30642b033a Mon Sep 17 00:00:00 2001
From: Francois CB <74976008+Franciskid@users.noreply.github.com>
Date: Fri, 18 Sep 2026 15:48:42 +0200
Subject: [PATCH] Don't let a failed index.html backup block the injection
On linuxserver/jellyfin the web folder belongs to root, so copying
index.html to index.html.sharelinks.bak threw even when index.html itself
was writable, and the ShareLink action never got injected. The backup is
best-effort now.
Bump to 1.0.7.0.
---
.../Jellyfin.Plugin.ShareLinks.csproj | 6 ++---
.../Web/WebInjectionHostedService.cs | 23 +++++++++++++++----
Jellyfin.Plugin.ShareLinks/meta.json | 4 ++--
3 files changed, 23 insertions(+), 10 deletions(-)
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("