mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-22 04:56:35 +00:00
Merge pull request #767 from tcely/patch-3
Prevent unintended changes to the cached dictionary
This commit is contained in:
commit
e45fce54bc
@ -2,10 +2,11 @@ import os
|
|||||||
import uuid
|
import uuid
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
from xml.etree import ElementTree
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
from copy import deepcopy
|
||||||
from datetime import datetime, timedelta, timezone as tz
|
from datetime import datetime, timedelta, timezone as tz
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from xml.etree import ElementTree
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.core.exceptions import SuspiciousOperation
|
from django.core.exceptions import SuspiciousOperation
|
||||||
@ -1058,7 +1059,7 @@ class Media(models.Model):
|
|||||||
if not data:
|
if not data:
|
||||||
cached = getattr(self, '_cached_metadata_dict', None)
|
cached = getattr(self, '_cached_metadata_dict', None)
|
||||||
if cached:
|
if cached:
|
||||||
data = cached
|
return deepcopy(cached)
|
||||||
else:
|
else:
|
||||||
data = json.loads(self.metadata or "{}")
|
data = json.loads(self.metadata or "{}")
|
||||||
if not isinstance(data, dict):
|
if not isinstance(data, dict):
|
||||||
|
Loading…
Reference in New Issue
Block a user