Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions src/fosslight_android/check_notice_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,22 @@ def find_files_by_extension(path):
return files


def read_notice_file(notice_file_path, notice_html_file):
def read_notice_file(notice_file_path):
final_notice_file = {}
# NOTICE.html need to be skipped the errors related to decode
encodings = ["latin-1", "utf-8", "utf-16"]
notice_files = []

if notice_html_file != "":
notice_files = notice_html_file.split(",")
else:
if os.path.isfile(notice_file_path):
notice_files.append(notice_file_path)
if notice_file_path.endswith(".html") or notice_file_path.endswith(".xml") or notice_file_path.endswith(".txt"):
notice_file_path = os.path.dirname(notice_file_path)

if os.path.isdir(notice_file_path):
additional_notice_files = find_files_by_extension(notice_file_path)
if len(additional_notice_files) > 0:
notice_files.extend(additional_notice_files)
notice_files = list(set(notice_files))
if os.path.isfile(notice_file_path):
notice_files.append(notice_file_path)
if notice_file_path.endswith(".html") or notice_file_path.endswith(".xml") or notice_file_path.endswith(".txt"):
notice_file_path = os.path.dirname(notice_file_path)

if os.path.isdir(notice_file_path):
additional_notice_files = find_files_by_extension(notice_file_path)
if len(additional_notice_files) > 0:
notice_files.extend(additional_notice_files)
notice_files = list(set(notice_files))

for file_name in notice_files:
file_list = {}
Expand Down
Loading