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
Disallow event tracking with empty/whitespace categories #11819
Conversation
js/piwik.js
Outdated
@@ -4957,7 +4957,7 @@ if (typeof window.Piwik !== 'object') { | |||
function logEvent(category, action, name, value, customData, callback) | |||
{ | |||
// Category and Action are required parameters | |||
if (String(category).length === 0 || String(action).length === 0) { | |||
if (this.trim(String(category)).length === 0 || this.trim(String(action)).length === 0) { |
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 should prevent requests being sent with whitespaced category or action
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.
Should we log an error to the console in this case?
@@ -53,7 +53,7 @@ public static function updateActionsTableWithRowQuery($query, $fieldQueried, & $ | |||
unset($row[PiwikMetrics::INDEX_SITE_SEARCH_HAS_NO_RESULT]); | |||
} | |||
|
|||
if (in_array($row['type'], array(Action::TYPE_CONTENT, Action::TYPE_EVENT))) { | |||
if (in_array($row['type'], array(Action::TYPE_CONTENT, Action::TYPE_EVENT, Action::TYPE_EVENT_NAME))) { |
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 should fix the failing archiving for already tracked empty categories.
Looks good to me. To be defined if we log an error or not in tracker. |
As this case seems currently to be the only case where we "actively" discard an tracking request guess logging an error wouldn't be bad. Updated the PR :) |
LGTM if tests pass |
Build failure seems not to be related to this changes |
fixes #11623