Skip to content

Commit 34d7710

Browse files
authored
Merge pull request #476 from twpol/feature/update-from-anywhere
fix: Allow official releases via GitHub https://bugs.launchpad.net/or/+bug/1943337
2 parents 2f44c45 + e1c1b46 commit 34d7710

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Source/ORTS.Updater/UpdateManager.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,16 @@ void ValidateLastUpdate()
222222
if (LastUpdate != null)
223223
{
224224
var uri = new Uri(LastUpdate.Url, UriKind.RelativeOrAbsolute);
225-
if (uri.IsAbsoluteUri)
226-
{
227-
LastUpdate = null;
228-
LastCheckError = new InvalidDataException("Update URL must be relative to channel URL.");
229-
}
225+
226+
// All relative URLs are valid
227+
if (!uri.IsAbsoluteUri) return;
228+
229+
// Official GitHub URLs are valid
230+
if (uri.Scheme == "https" && uri.Host == "github.com" && uri.AbsolutePath.StartsWith("/openrails/openrails/releases")) return;
231+
232+
// Everything else is invalid
233+
LastUpdate = null;
234+
LastCheckError = new InvalidDataException("Update URL must be relative to channel URL or from https://github.com/openrails/openrails/releases.");
230235
}
231236
}
232237

0 commit comments

Comments
 (0)