Skip to content

Commit

Permalink
Merge remote-tracking branch 'github/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
datlt4 committed Oct 14, 2024
2 parents 7352395 + 0e24327 commit 6d71eef
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fhost.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,12 +1059,12 @@ def fetch_content():
if request.method == "POST":
url = request.form["url"]
if len(HTTP_URL_PATTERN.findall(url))==0:
url = os.path.join("http://localhost:5000", url)
url = os.path.join(f"http://localhost:{request.environ.get('SERVER_PORT')}", url)
else:
base_url = HTTP_URL_PATTERN.findall(request.url)
if len(base_url) > 0:
base_url = base_url[0]
url = url.replace(base_url, "http://localhost:5000")
url = url.replace(base_url, f"http://localhost:{request.environ.get('SERVER_PORT')}")

if not request.url:
return jsonify({"error": "URL parameter is required"}), 400
Expand All @@ -1084,12 +1084,12 @@ def fetch_file():
if request.method == "POST":
url = request.form["url"]
if len(HTTP_URL_PATTERN.findall(url))==0:
url = os.path.join("http://localhost:5000", url)
url = os.path.join(f"http://localhost:{request.environ.get('SERVER_PORT')}", url)
else:
base_url = HTTP_URL_PATTERN.findall(request.url)
if len(base_url) > 0:
base_url = base_url[0]
url = url.replace(base_url, "http://localhost:5000")
url = url.replace(base_url, f"http://localhost:{request.environ.get('SERVER_PORT')}")

if not request.url:
return jsonify({"error": "URL parameter is required"}), 400
Expand Down

0 comments on commit 6d71eef

Please sign in to comment.