-
Notifications
You must be signed in to change notification settings - Fork 74
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
Constraint labels can break CQM (de-)serialization #1358
Labels
Comments
arcondello
added a commit
to arcondello/dimod
that referenced
this issue
Sep 13, 2023
arcondello
added a commit
to arcondello/dimod
that referenced
this issue
Sep 13, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Currently
CQM.to_file()
encodes constraint labels withjson.dumps
, allowing characters that are illegal in file names, like/
. That becomes a problem only when trying to extract the CQM zip file.However,
CQM.from_file()
assumes forward slashes are not allowed in file names and that/
is used only as (POSIX) path separator:dimod/dimod/constrained/constrained.py
Lines 1071 to 1073 in 85f5baf
Consequently, decoding CQMs with slashes in constraint labels will fail.
Steps To Reproduce
Expected Behavior
Serializing CQMs with forward slashes (and some other unicode characters, like NULL) should be forbidden. Or at least such labels should be renamed, either on constraint creation, or cqm serialization.
Environment
dimod==0.12.12
The text was updated successfully, but these errors were encountered: