Skip to content

Commit 3a0a265

Browse files
committed
Enable sentry caching to avoid sentry writing outside of game directory
See #31412. Probably safe enough.
1 parent b469885 commit 3a0a265

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

osu.Game/OsuGame.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,6 @@ public OsuGame(string[] args = null)
232232

233233
forwardGeneralLogsToNotifications();
234234
forwardTabletLogsToNotifications();
235-
236-
SentryLogger = new SentryLogger(this);
237235
}
238236

239237
#region IOverlayManager
@@ -323,6 +321,8 @@ public override void SetHost(GameHost host)
323321
{
324322
base.SetHost(host);
325323

324+
SentryLogger = new SentryLogger(this, Storage);
325+
326326
if (host.Window != null)
327327
{
328328
host.Window.CursorState |= CursorState.Hidden;

osu.Game/Utils/SentryLogger.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using osu.Framework.Bindables;
1212
using osu.Framework.Configuration;
1313
using osu.Framework.Logging;
14+
using osu.Framework.Platform;
1415
using osu.Framework.Statistics;
1516
using osu.Game.Beatmaps;
1617
using osu.Game.Configuration;
@@ -36,19 +37,17 @@ public class SentryLogger : IDisposable
3637

3738
private readonly OsuGame game;
3839

39-
public SentryLogger(OsuGame game)
40+
public SentryLogger(OsuGame game, Storage? storage = null)
4041
{
4142
this.game = game;
4243

43-
if (!game.IsDeployedBuild || !game.CreateEndpoints().WebsiteRootUrl.EndsWith(@".ppy.sh", StringComparison.Ordinal))
44-
return;
45-
4644
sentrySession = SentrySdk.Init(options =>
4745
{
4846
options.Dsn = "https://ad9f78529cef40ac874afb95a9aca04e@sentry.ppy.sh/2";
4947
options.AutoSessionTracking = true;
5048
options.IsEnvironmentUser = false;
5149
options.IsGlobalModeEnabled = true;
50+
options.CacheDirectoryPath = storage?.GetFullPath(string.Empty);
5251
// The reported release needs to match version as reported to Sentry in .github/workflows/sentry-release.yml
5352
options.Release = $"osu@{game.Version.Replace($@"-{OsuGameBase.BUILD_SUFFIX}", string.Empty)}";
5453
});

0 commit comments

Comments
 (0)