Skip to content
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

Fix TorrentDefNoMetainfo.get_name_utf8() to return string #7842

Merged
merged 2 commits into from
Jan 23, 2024

Conversation

xoriole
Copy link
Contributor

@xoriole xoriole commented Jan 22, 2024

Fixes #7836

The downloads response was not JSON serializable because the name was still being returned as bytes in case of serialization of name from torrent def of instance TorrentDefNoMetainfo. This PR fixes the issue.

@xoriole xoriole marked this pull request as ready for review January 22, 2024 15:29
@xoriole xoriole requested a review from a team as a code owner January 22, 2024 15:29
@xoriole xoriole requested review from drew2a and removed request for a team January 22, 2024 15:29
Copy link
Collaborator

@drew2a drew2a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, despite the fact that in TorrentDefNoMetainfo there is a violation of the Liskov Substitution Principle, at least in the constructor. However, this is not your fault, but rather a design issue from the author of the class.

@qstokkink
Copy link
Contributor

there is a violation of the Liskov Substitution Principle, at least in the constructor.

@drew2a could you provide more details on this violation? AFAIK the substitution principle does not apply to constructors.

@drew2a
Copy link
Collaborator

drew2a commented Jan 23, 2024

@qstokkink, you are right; the Liskov Substitution Principle is not applicable to constructors. It was a false alarm.

@xoriole xoriole merged commit a6b74dd into Tribler:main Jan 23, 2024
34 checks passed
@drew2a
Copy link
Collaborator

drew2a commented Jan 23, 2024

I apologize to the unknown author of this class 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError: Object of type bytes is not JSON serializable - DownloadsEndpoint
3 participants