Skip to content

Commit

Permalink
Merge pull request #2887 from andrewbaldwin44/bugfix/download-from-url
Browse files Browse the repository at this point in the history
Filename from URL Should Strip Query Params
  • Loading branch information
cyberw authored Sep 4, 2024
2 parents c040d92 + 5d287cd commit 442f9f9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion locust/argument_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import textwrap
from collections import OrderedDict
from typing import Any, NamedTuple
from urllib.parse import urlparse
from uuid import uuid4

if sys.version_info >= (3, 11):
Expand Down Expand Up @@ -159,7 +160,7 @@ def download_locustfile_from_url(url: str) -> str:
sys.stderr.write(f"Failed to get locustfile from: {url}. Response is not valid python code.")
sys.exit(1)

with open(os.path.join(tempfile.gettempdir(), url.rsplit("/", 1)[-1]), "w") as locustfile:
with open(os.path.join(tempfile.gettempdir(), urlparse(url).path.split("/")[-1]), "w") as locustfile:
locustfile.write(response.text)

atexit.register(exit_handler, locustfile.name)
Expand Down

0 comments on commit 442f9f9

Please sign in to comment.