Skip to content

Commit 627e806

Browse files
Normalize images
1 parent 0e6d671 commit 627e806

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎.github/workflows/normalize-images.yml‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,10 @@ jobs:
137137
138138
IMG_EXT = r"(?:png|jpe?g|gif|webp|svg|gifv)"
139139
140-
# Defensive: strip any trailing > from URL fragments
141-
url = url.strip().rstrip('>')
142-
143140
def clean_filename_from_url(url: str) -> str:
144-
# 💡 Defensive: strip accidental empty-title tokens that leaked into URL
141+
# Trim and remove any trailing '>' that can leak from <...> wrappers
142+
url = url.strip().rstrip('>')
143+
# Defensive: strip accidental empty-title tokens that leaked into URL
145144
# e.g. "/_images/image-(810 "").png" -> "/_images/image-(810).png"
146145
url = re.sub(r'\s*""', '', url)
147146
@@ -271,7 +270,7 @@ jobs:
271270
# 6) Catch-all: fix bare .gitbook/assets occurrences (outside code fences)
272271
out_lines, fenced = [], False
273272
fence_re = re.compile(r'^\s*```')
274-
asset_re = re.compile(r'(\.gitbook/assets/[^)\s"\'<>]+)', re.I)
273+
asset_re = re.compile(r'(\.gitbook/assets/[^"\'<>]+)', re.I)
275274
for ln in s.splitlines():
276275
if fence_re.match(ln):
277276
fenced = not fenced

0 commit comments

Comments
 (0)