-
Notifications
You must be signed in to change notification settings - Fork 161
fix(BA-1167): Wrong custom image owner check logic #4181
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
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.
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
@@ -798,7 +798,8 @@ def set_resource_limit( | |||
self._resources = resources | |||
|
|||
def is_owned_by(self, user_id: UUID) -> bool: | |||
return self.customized and self.labels["ai.backend.customized-image.owner"] == str(user_id) | |||
owner_label = self.labels["ai.backend.customized-image.owner"] |
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.
Splitting the label on ':' assumes it always has a colon; consider adding a check on the split result length to prevent possible IndexError if the label is improperly formatted.
owner_label = self.labels["ai.backend.customized-image.owner"] | |
owner_label = self.labels["ai.backend.customized-image.owner"] | |
if ":" not in owner_label: | |
return False |
Copilot uses AI. Check for mistakes.
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
resolves #4182 (BA-1167).
Checklist: (if applicable)