Skip to content

Instantly share code, notes, and snippets.

@andrewdavey
Created November 18, 2010 12:02
Show Gist options
  • Save andrewdavey/704900 to your computer and use it in GitHub Desktop.
Save andrewdavey/704900 to your computer and use it in GitHub Desktop.
Potential encoding bug in RavenDB's /static response
static void StaticKeyBug()
{
using (var store = new DocumentStore())
{
store.Url = "http://localhost:8080";
store.Initialize();
store.DatabaseCommands.PutAttachment("test/hello/world", null, new byte[] { 1, 2, 3 }, new JObject());
using (var wc = new WebClient())
{
var staticJson = wc.DownloadString("http://localhost:8080/static");
foreach (var item in JArray.Parse(staticJson))
{
Console.WriteLine(item["Key"].ToString());
}
// My output looks like this:
//"t\u0000e\u0000s\u0000t\u0000/\u0000h\u0000e\u0000l\u0000l\u0000o\u0000/\u0000w\u0000o\u0000r\u0000l\u0000d\u0000"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment