Skip to content

Commit

Permalink
Updated js match script to use file path generated with ConfigManager…
Browse files Browse the repository at this point in the history
…().get_data_dir_path() instead of hardcoded path that no longer exists.
  • Loading branch information
willis89pr committed Dec 17, 2024
1 parent 56375ca commit 3a223e2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/js_libraries/match_javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import requests

from surfactant.configmanager import ConfigManager


def get_test_file():
url = "https://cdnjs.cloudflare.com/ajax/libs/select2/3.5.4/select2.min.js"
Expand Down Expand Up @@ -32,8 +34,8 @@ def find_js_match(expressions: dict, filename: str) -> str:


get_test_file()

with open("js_library_patterns.json", "r") as f:
json_file_path = ConfigManager().get_data_dir_path() / "infoextractors" / "js_library_patterns.json"
with open(json_file_path, "r") as f:
patterns = json.load(f)

library_name = find_js_match(patterns, "testFile.js")
Expand Down

0 comments on commit 3a223e2

Please sign in to comment.