Skip to content

Commit b3fba78

Browse files
committed
fixed bug in decoder module
1 parent f12f329 commit b3fba78

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
## "JavaScript Source Maps Decoder
1+
## JavaScript Source Maps Decoder
22

33
Тут скоро будет описание. :)
44

55
### Состав
66

7+
- [crawler]()
78
- [downloader](downloader.py)
89
- [decoder](decoder.py)
910
- [merger]()

‎decoder.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ def save_statistic_file(output_file_folder: Path, statistic: Any) -> None:
4848
output_file_folder.write_text(json.dumps(statistic, indent=2))
4949

5050

51+
def remove_first_slash(file_path: str) -> str:
52+
while file_path.startswith("/"):
53+
file_path = file_path.removeprefix("/")
54+
55+
return file_path
56+
57+
5158
def save_decode_result(output_folder: Path, bundle_name: str, decode_result: source_maps.DecodeResult) -> None:
5259
folder_path = output_folder / bundle_name
5360
if not folder_path.exists():
@@ -75,7 +82,7 @@ def save_decode_result(output_folder: Path, bundle_name: str, decode_result: sou
7582
file_path = new_value
7683

7784
# Убираем первый '/', что-бы не попасть в корень диска
78-
file_path = file_path.removeprefix("/")
85+
file_path = remove_first_slash(file_path)
7986

8087
# Путь восстанавливаемого файла в Sources Map
8188
file_path_in_sm = relative_folder_in_sm / file_path

0 commit comments

Comments
 (0)