Skip to content

fix: handle datafile provided as bytes - #384

Merged
Andy Leap (andrewleap-optimizely) merged 1 commit into
masterfrom
aleap/fix_datafile_export
Jun 2, 2022
Merged

Andy Leap (andrewleap-optimizely) merged 1 commit into
masterfrom
aleap/fix_datafile_export

Conversation

@andrewleap-optimizely

Copy link
Copy Markdown
Contributor

Summary

  • If datafile is provided as bytes, convert to str

The PollingConfigManager provides the datafile as bytes.

Test plan

  • test_config.test_to_datafile_from_bytes
  • test_optimizely_config.test__get_datafile_from_bytes

Issues

Currently if the datafile is provided as bytes, including using the default PollingConfigManager, it is converted to str incorrectly, resulting in an invalid JSON string being returned from ProjectConfig.to_datafile and OptimizelyConfig.get_datafile.

Steps to replicate:

client = optimizely.Optimizely(sdk_key=sdk_key)
project_config = client.config_manager.get_config()
datafile = project_config.to_datafile()
json.loads(datafile)

@Mat001 Matjaz Pirnovar (Mat001) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@alexanderchabo

Copy link
Copy Markdown

Hey Andy Leap (@andrewleap-optimizely), do you know when this possibly is released? :)

Our team is somewhat blocked on this as the datafile is reported as malformed when digested in the javascript-sdk.

@andrewleap-optimizely

Copy link
Copy Markdown
Contributor Author

Alexander Chabo (@alexanderchabo) we have released this change in v4.1.0

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.

3 participants