Skip to content

Commit 52659f5

Browse files
authored
Fix the pub_deps.json parsing issue (#206)
Signed-off-by: jiyeong.seok <[email protected]>
1 parent f9de57d commit 52659f5

File tree

1 file changed

+10
-1
lines changed
  • src/fosslight_dependency/package_manager

1 file changed

+10
-1
lines changed

src/fosslight_dependency/package_manager/Pub.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,16 @@ def parse_direct_dependencies(self):
182182

183183
if os.path.exists(tmp_pub_deps_file) and os.path.exists(tmp_no_dev_deps_file):
184184
try:
185-
with open(tmp_pub_deps_file, 'r', encoding='utf8') as deps_f:
185+
with open(tmp_pub_deps_file, 'r+', encoding='utf8') as deps_f:
186+
lines = deps_f.readlines()
187+
deps_f.seek(0)
188+
deps_f.truncate()
189+
for num, line in enumerate(lines):
190+
if line.startswith('{'):
191+
first_line = num
192+
break
193+
deps_f.writelines(lines[first_line:])
194+
deps_f.seek(0)
186195
deps_l = json.load(deps_f)
187196
self.parse_pub_deps_file(deps_l)
188197
with open(tmp_no_dev_deps_file, 'r', encoding='utf8') as no_dev_f:

0 commit comments

Comments
 (0)