Skip to content

garbage on box creation is byte and storing in postgres uses more than 32 char #570

Closed
@dadokkio

Description

@dadokkio

The code to generate garbage field in box model returns a bytes string

>>> from libs.StringCoding import encode
>>> from os import urandom
>>> encode(urandom(16), "hex")
b'b0d37f28b972c3fa1f0f57b9557491cd'

Storing this data in postgres causes error:

webapp_1     |     [SQL: INSERT INTO box (created, uuid, corporation_id, category_id, _name, _operating_system, _description, _capture_message, _difficulty, game_level_id, _avatar, _value, _locked, _order, garbage, flag_submission_type) VALUES (%(created)s, %(uuid)s, %(corporation_id)s, %(category_id)s, %(_name)s, %(_operating_system)s, %(_description)s, %(_capture_message)s, %(_difficulty)s, %(game_level_id)s, %(_avatar)s, %(_value)s, %(_locked)s, %(_order)s, %(garbage)s, %(flag_submission_type)s) RETURNING box.id]
webapp_1     |     [parameters: {'created': datetime.datetime(2023, 6, 9, 10, 16, 6, 130432), 'uuid': 'a8ad8b7f-8274-455a-ab66-f7288c1782c2', 'corporation_id': 1, 'category_id': None, '_name': 'safasfa', '_operating_system': '?', '_description': '', '_capture_message': '', '_difficulty': '', 'game_level_id': 1, '_avatar': None, '_value': 0, '_locked': False, '_order': None, 'garbage': b'aef705be8ce5e59dbc76b6dcf43740af', 'flag_submission_type': 'CLASSIC'}]

The value that it wants to save in the db is \x6439613663616530336463373030656535326632653361616531643139353866 obtained changing garbage field size to 200char

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions