-
-
Notifications
You must be signed in to change notification settings - Fork 255
Fix: Trim Unicode NULL character for Windows support #420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -397,6 +409,7 @@ class LoadReleaseIntegration extends Integration<SentryFlutterOptions> { | |||
.replaceAll('\t', '_') | |||
.replaceAll('\r\n', '_') | |||
.replaceAll('\r', '_') | |||
.replaceAll('\n', '_'); | |||
.replaceAll('\n', '_') | |||
.replaceAll('\u{0000}', ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to be sure that this works on Windows, maybe @bruno-garcia can test it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dream of integration test on the target platform that will validate these for us. Mainly because of regressions introduced later.
Thoughts? Q2 is the time to plan and book these tasks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name = _cleanString(packageInfo.appName); | ||
} | ||
|
||
final version = _cleanString(packageInfo.version); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block is guarded by either release
or dist
being empty on options. But below we only take the release
built in here, if options.release
is not empty, we just use that, and same for dist
.
So if only options.release
is set, we'll build a new release (as per this block) but won't use it at all.
Would it make sense to check if +
exists and append the buildNumber
we detected in that case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the ??
does the job if I got what you meant eg
options.release = options.release ?? release;
but what we could do is to actually check if we need to build the release
or dist
only and not execute code that is not necessary, eg, building a new release
if we're going to use the options.release
anyway as its not empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah it's already using options.release if it's already set, it's just odd that we build a new release value even though it's not used.
And I was trying to think of ways to combine what we built in the block with what was defined but best not mess around with a value that was explicitly set by the user on options.
So the only improvement here is as you said just to avoid doing the work if not needed though it'll make the logic more complicated
options.logger(SentryLevel.debug, 'release: $release'); | ||
|
||
options.release = options.release ?? release; | ||
options.dist = options.dist ?? packageInfo.buildNumber; | ||
if (buildNumber.isNotEmpty) { | ||
options.dist = options.dist ?? packageInfo.buildNumber; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might need check the format of build number. Will this always be in a valid format as per Sentry's spec?
https://docs.sentry.io/platforms/dart/configuration/releases/#bind-the-version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #422
Co-authored-by: Manoel Aranda Neto <[email protected]>
If I opened the right JSON, |
Codecov Report
@@ Coverage Diff @@
## feature/support-desktop #420 +/- ##
===========================================================
+ Coverage 90.02% 93.52% +3.50%
===========================================================
Files 54 5 -49
Lines 1684 170 -1514
===========================================================
- Hits 1516 159 -1357
+ Misses 168 11 -157 Continue to review full report at Codecov.
|
oof, you're right @marandaneto "release": "sentry_flutter_example\u0000@1.0.0", |
There's no general 'error processing your event' on the event though. Wasn't that the case before this change? |
before it was |
I think that's because |
.getIntegration(loader: loader) | ||
.call(MockHub(), fixture.options); | ||
|
||
expect(fixture.options.release, 'sentry_flutter_example+123'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is wrong, in this case, if there's no version
, it should be sentry_flutter_example@123
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll confirm that, let's keep as it is for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is actually not going to happen because pubspec must have a version
or it defaults to 0.0.0 https://dart.dev/tools/pub/pubspec#version
its only possible because we've mocked the values, so no special anything case here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
📜 Description
I replace every \u0000 with `` (empty string).
💡 Motivation and Context
#410
💚 How did you test it?
I've written new tests
📝 Checklist
🔮 Next steps
@bruno-garcia Could you please test this?