Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3733676
D8040.id27461.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D8040.id27461.diff
View Options
diff --git a/lib/utils/report-utils.js b/lib/utils/report-utils.js
--- a/lib/utils/report-utils.js
+++ b/lib/utils/report-utils.js
@@ -13,18 +13,29 @@
return useSelector(state => state.reportStore.enabledReports[reportType]);
}
+// maximum size of reports without std::string overhead
+const MAX_REPORT_LENGTH = 200_000_000 - 90000;
+function isReportSizeValid(report: ClientReportCreationRequest): boolean {
+ try {
+ return JSON.stringify(report).length < MAX_REPORT_LENGTH;
+ } catch (e) {
+ return false;
+ }
+}
+
function isReportEnabled(
report: ClientReportCreationRequest,
enabledReports: EnabledReports,
): boolean {
- return (
+ const isReportTypeEnabled =
(report.type === reportTypes.MEDIA_MISSION &&
enabledReports.mediaReports) ||
(report.type === reportTypes.ERROR && enabledReports.crashReports) ||
((report.type === reportTypes.ENTRY_INCONSISTENCY ||
report.type === reportTypes.THREAD_INCONSISTENCY) &&
- enabledReports.inconsistencyReports)
- );
+ enabledReports.inconsistencyReports);
+
+ return isReportTypeEnabled && isReportSizeValid(report);
}
function generateReportID(): string {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 10, 2:58 AM (13 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2835406
Default Alt Text
D8040.id27461.diff (1 KB)
Attached To
Mode
D8040: [lib] limit report size to 200MB
Attached
Detach File
Event Timeline
Log In to Comment