Skip to content

Commit c743520

Browse files
authored
fix: The website knowledge base lacks comprehensive methods for determining files and folders, resulting in ineffective access to links within the final document #2935 (#3893)
1 parent e910217 commit c743520

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

apps/common/util/fork.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import re
44
import traceback
55
from functools import reduce
6+
from pathlib import Path
67
from typing import List, Set
78
from urllib.parse import urljoin, urlparse, ParseResult, urlsplit, urlunparse
89

@@ -70,6 +71,8 @@ def error(message: str):
7071

7172
def __init__(self, base_fork_url: str, selector_list: List[str]):
7273
base_fork_url = remove_fragment(base_fork_url)
74+
if any([True for end_str in ['index.html', '.htm', '.html'] if base_fork_url.endswith(end_str)]):
75+
self.base_fork_url = str(Path(base_fork_url).parent)
7376
self.base_fork_url = urljoin(base_fork_url if base_fork_url.endswith("/") else base_fork_url + '/', '.')
7477
parsed = urlsplit(base_fork_url)
7578
query = parsed.query

0 commit comments

Comments
 (0)