Bug: New lines in album name and returned album list.

Sytone
Sytone's picture

Joined: 2002-11-11
Posts: 16
Posted: Mon, 2002-11-11 22:27

You can put a newline in the album name, this breaks the returned data format from fetch-albums as you get the following which has a newline which could be empty or full...

#__GR2PROTO__
...
album.name.4=album02
album.title.4=Pretty

album.parent.4=0
album.perms.add.4=true
album.perms.write.4=true
album.perms.del_item.4=true
album.perms.del_alb.4=true
album.perms.create_sub.4=true
album.name.5=album05
album.title.5=Untitled
album.parent.5=4
album.perms.add.5=true
album.perms.write.5=true
album.perms.del_item.5=true
album.perms.del_alb.5=true
album.perms.create_sub.5=true
...
album_count=9
status=0
status_text=Fetch albums successful.

 
Sytone
Sytone's picture

Joined: 2002-11-11
Posts: 16
Posted: Mon, 2002-11-11 22:39

Ha, it may be just me.. this c# code works it out...

while (CurrentPosition < KeyValue.Length)
{
string Key;
string Value;

try
{
Key = KeyValue.Substring(CurrentPosition, (KeyValue.IndexOf("=",CurrentPosition)-CurrentPosition));
CurrentPosition = KeyValue.IndexOf("=",CurrentPosition)+1;
Value = KeyValue.Substring(CurrentPosition, (KeyValue.LastIndexOf("n",KeyValue.IndexOf("=", CurrentPosition))-CurrentPosition));
CurrentPosition = KeyValue.LastIndexOf("n",KeyValue.IndexOf("=", CurrentPosition))+1;
ReturnData.Add(Key, Value);
}
catch
{
CurrentPosition = KeyValue.Length+1;
}
}

 
Sytone
Sytone's picture

Joined: 2002-11-11
Posts: 16
Posted: Mon, 2002-11-11 23:05

Got it working now.. here is screenshot of my prototype...

<!-- BBCode Start --><IMG SRC="http://www.sytone.net/albums/album65/aaa.jpg"><!-- BBCode End -->

 
paour
paour's picture

Joined: 2002-08-14
Posts: 1479
Posted: Tue, 2002-11-12 00:59

Now escaping newlines (1.3.2b26 and later). Thanks for the catch (this would have caused titles to be truncated in GR Java).