mirror of
https://github.com/placeAtlas/atlas.git
synced 2024-09-27 20:48:56 +02:00
Handle escaping escape characters
This commit is contained in:
parent
1da79b806b
commit
cd87520c87
1 changed files with 3 additions and 1 deletions
|
@ -69,8 +69,10 @@
|
|||
text = submission.selftext
|
||||
rawtext = text
|
||||
|
||||
text = text.replace("\\", "")
|
||||
text = re.compile(r".*(\{.+\}).*", re.DOTALL).search(text).group(1)
|
||||
# Test if it needs to escape the escape character. Usually happens on fancy mode.
|
||||
try: json.loads(text)
|
||||
except json.JSONDecodeError: text = re.sub(r"\\(.)", r"\1", text)
|
||||
|
||||
submission_json = json.loads(text)
|
||||
|
||||
|
|
Loading…
Reference in a new issue