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

[possible bug] updating array of strings #75

Closed
dzannotti opened this issue Dec 18, 2015 · 10 comments
Closed

[possible bug] updating array of strings #75

dzannotti opened this issue Dec 18, 2015 · 10 comments

Comments

@dzannotti
Copy link

having described in my model images: [String] when i attempt to save

images: [
  "fc6092ab09574edd9cb82c665f97fb0b"
  "c01a8ab7196e45c6981cb58f58152db6"
  "3bcd62558a8a444ea9f1996efda062de"
  "a23530eb3694408f8e8ef3a81fe3ceed"
  "77dd890281ea4cd8b2cb4487c433dcdf"
]

in the database seems to save

"images": [
        "e\u007f{}=\u001b",
        "wM\\o\u001f\u001fgMyYVz",
        "3bcd62558a8a444ea9f1996efda062de",
        "a23530eb3694408f8e8ef3a81fe3ceed",
        "77dd890281ea4cd8b2cb4487c433dcdf"
    ]

This doesn't seems to be consistently reproduceable but seems to happen only when the value of the string contains hashes (perhaps they get confused at times with ObjectId?)

@tothandras
Copy link
Contributor

Yes, you are right! There is a fix hidden in this commit, but it hasn't been released yet. I'll do a release soon, it will most likely fix your problem.

@dzannotti
Copy link
Author

Sadly I'm already using that version and doesn't seem to fix the issue

@tothandras
Copy link
Contributor

hmm... strange :/ Let me take a look at it in a few hours (just got home from the SW premier, it's already 4am :)) It would be nice if you could test it too, so you might find where the error comes from.

@tothandras
Copy link
Contributor

@dzannotti Okay, I think it's fixed now. Try out version 5.0.1!

@dzannotti
Copy link
Author

@tothandras oh wow, i wasn't expecting such a quick fix! Was going to write some tests for it and PR tonight with a fix, but you got was waaay ahead of me. Will test it out, that's great, i do wonder if a safer way to figure out if the id is of mongo or global relay is to verify if it ends with = as originally was checking along other things, graphql-relay uses base64 encoding to it'll always end with = while to the best of my knowledge no mongoid will do that

@tothandras
Copy link
Contributor

Yes, you are right! I was thinking about that before, but as far as I know
= at the end indicates duplicated characters or something. I wasn't brave
enough to use this, but at the same time I couldn't find an ID without it.
:)

On Fri, Dec 18, 2015, 14:58 Daniele Zannotti notifications@github.com
wrote:

@tothandras https://github.com/tothandras oh wow, i wasn't expecting
such a quick fix! Was going to write some tests for it and PR tonight with
a fix, but you got was waaay ahead of me. Will test it out, that's great, i
do wonder if a safer way to figure out if the id is of mongo or global
relay is to verify if it ends with = as originally was checking along
other things, graphql-relay uses base64 encoding to it'll always end with
= while to the best of my knowledge no mongoid will do that


Reply to this email directly or view it on GitHub
#75 (comment)
.

@dzannotti
Copy link
Author

To the best of my knowledge = is used as padding to indicate that the last character encoded is 8 or 16 bits, so in theory not every base64 string would end with a = however i never came across one that didn't have it. Not had the chance to try the fix yet however after reporting this issue, it seem to have appear randomly on other string fields (not necesarly arrays). WIll upgrade and investigate as soon as i can

@tothandras
Copy link
Contributor

@dzannotti You are most certainly right, I don't trust my memories. :) Update me if you tried it!

@dzannotti
Copy link
Author

yep confirmed working in 5.0.1, thank you for this!

@tothandras
Copy link
Contributor

@dzannotti Thanks for the bug report!

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

No branches or pull requests

2 participants