-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch_zip.py
More file actions
28 lines (22 loc) · 1.21 KB
/
Copy pathpatch_zip.py
File metadata and controls
28 lines (22 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
path = "/Users/kanrisha/projects/proofmark-lp/client/src/lib/zipStreamer.ts"
with open(path, "r") as f:
content = f.read()
# Replace Phase 1
content = content.replace(
"if ((err as DOMException).name === 'AbortError') {\n // ダイアログのキャンセル。\n return;\n }",
"if ((err as DOMException).name === 'AbortError') {\n // ダイアログのキャンセル。\n throw err;\n }"
)
# Replace Phase 2
content = content.replace(
"if ((err as DOMException).name === 'AbortError') {\n try { await writable.abort?.(); } catch { /* noop */ }\n return;\n }",
"if ((err as DOMException).name === 'AbortError') {\n try { await writable.abort?.(); } catch { /* noop */ }\n throw err;\n }"
)
# Replace Route B
content = content.replace(
"if ((err as DOMException).name === 'AbortError') {\n try { await fileStream?.abort?.(); } catch { /* noop */ }\n return;\n }",
"if ((err as DOMException).name === 'AbortError') {\n try { await fileStream?.abort?.(); } catch { /* noop */ }\n throw err;\n }"
)
with open(path, "w") as f:
f.write(content)
print("Patch applied to zipStreamer.ts")