Skip to content

Commit

Permalink
fix(backup): ApiToken null refresh_token query error (#60660)
Browse files Browse the repository at this point in the history
  • Loading branch information
azaslavsky authored Nov 27, 2023
1 parent a414a25 commit 984e550
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sentry/models/apitoken.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ def write_relocation_import(
self, scope: ImportScope, flags: ImportFlags
) -> Optional[Tuple[int, ImportKind]]:
# If there is a token collision, generate new tokens.
query = models.Q(token=self.token) | models.Q(refresh_token=self.refresh_token)
query = models.Q(token=self.token) | models.Q(
refresh_token__isnull=False, refresh_token=self.refresh_token
)
existing = self.__class__.objects.filter(query).first()
if existing:
self.token = generate_token()
Expand Down

0 comments on commit 984e550

Please sign in to comment.