jlkatz / OCTGN.OCTGNDeckConverter

A comprehensive OCTGN deck converter for OCTGN 3 which can convert several formats, websites, and plain text into the OCTGN 3 format.
http://octgngames.com/deckconverter/
7 stars 9 forks source link

Importing from CardGameDB fails if strategy section has quotation marks #20

Open rmunn opened 8 years ago

rmunn commented 8 years ago

The ability to import decks from CardGameDB is wonderful, but it fails if a deck's strategy section contains quotation marks: the Newtonsoft JSON parser throws an exception. (I've only observed this on decks that haven't been "submitted", since I have never submitted any decks myself.)

To help reproduce the problem, here's a link to my old "The Eagles are Coming!" deck:

http://www.cardgamedb.com/index.php/thelordoftherings/the-lord-of-the-rings-deck-share?p=4028&deck=lotrdeck_53acdef6bd2c7

The strategy notes for this deck are as follows:

Mono-tactics Eagles deck, with a lot of potential for damaging enemies in the staging area.

"Gandalf" cards are proxies for Gwaihir until he is released.

The error message that I get when I try to import that deck is:

An error occurred while trying to convert the deck. Please try again.

Details: Newtonsoft.Json.JsonReaderException: After parsing a value an unexpected character was encountered: G. Path 'strategy', line 1, position 170. at Newtonsoft.Json.JsonTextReader.ParsePostValue() at Newtonsoft.Json.JsonTextReader.ReadInternal() at Newtonsoft.Json.JsonTextReader.Read() at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateJObject(JsonReader reader) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at OCTGNDeckConverter.Model.ConvertEngine.Webpage.CardGameDB_com.Convert(String url, IEnumerable1 deckSectionNames, Func3 convertGenericFileFunc) at OCTGNDeckConverter.Model.ConvertEngine.Game.LoTR.ConvertURL(String url, IEnumerable`1 deckSectionNames) at OCTGNDeckConverter.Model.ConvertEngine.Game.GameConverter.ConvertURL(String url, ConverterGame converterGame) at OCTGNDeckConverter.Model.ConvertEngine.ConvertEngine.ConvertURL(String url, ConverterGame converterGame) at OCTGNDeckConverter.Model.Converter.Convert()

Position 170 of the strategy text is the G of Gandalf, immediately after the quotation mark.

I've imported many decks that had strategy text without quotation marks, and they all worked fine, but all the decks I tried to import that did have quotation marks in their strategy text have failed. So I'm pretty sure the quotation marks are the cause of this issue.

This is with version 3.5.0 of the deck converter, released January 30, 2015.