aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2024-03-10 17:43:46 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2024-03-29 00:00:15 +0100
commit42d168d330af4acc276e61fd971a7c9cd9c1ca0c (patch)
treeaacd6fa5e0098f335cd60efe3922bec0aa6c1c07
parent8c814bea828b5cd9ed5de968383bef0aa169f0bc (diff)
downloadwee-slack-42d168d330af4acc276e61fd971a7c9cd9c1ca0c.tar.gz
Close LevelDB connection in extract_token_from_browser.py
This fixes an issue where the temporary directory couldn't be deleted after use because the connection to the LevelDB file in it was still open.
-rwxr-xr-xextract_token_from_browser.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/extract_token_from_browser.py b/extract_token_from_browser.py
index 36fe491..b68b53e 100755
--- a/extract_token_from_browser.py
+++ b/extract_token_from_browser.py
@@ -275,6 +275,7 @@ elif browser == "chrome":
try:
db = DB(str(leveldb_path))
local_storage_value = db.get(leveldb_key)
+ db.close()
except pIOErr:
with tempfile.TemporaryDirectory(
dir=local_storage_path, prefix="leveldb-", suffix=".tmp"
@@ -282,6 +283,7 @@ elif browser == "chrome":
shutil.copytree(leveldb_path, tmp_dir, dirs_exist_ok=True)
db = DB(tmp_dir)
local_storage_value = db.get(leveldb_key)
+ db.close()
local_config = json.loads(local_storage_value[1:]) if local_storage_value else None