Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

update filename in integration_test http_server #3739

Merged
merged 3 commits into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions integration_test/src/python/http_server/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pex_binary(
main = "main.py",
reqs = [
"tornado==4.5.3",
"werkzeug==2.0.2",
],
deps = [
"//heron/common/src/python:common-py",
Expand Down
5 changes: 3 additions & 2 deletions integration_test/src/python/http_server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import tornado.ioloop
import tornado.escape
import tornado.web
from werkzeug.utils import secure_filename

from heron.common.src.python.utils import log

Expand All @@ -32,7 +33,7 @@ def get(self):

class FileHandler(tornado.web.RequestHandler):
def get(self, fileName):
jsonFilePath = RESULTS_DIRECTORY + "/" + fileName + ".json"
jsonFilePath = RESULTS_DIRECTORY + "/" + secure_filename(fileName) + ".json"

if not os.path.exists(jsonFilePath):
self.clear()
Expand All @@ -46,7 +47,7 @@ def get(self, fileName):
self.write(data)

def post(self, fileName):
jsonFilePath = RESULTS_DIRECTORY + "/" + fileName + ".json"
jsonFilePath = RESULTS_DIRECTORY + "/" + secure_filename(fileName) + ".json"

#Overwrites the existing file
with open(jsonFilePath, "w") as jsonFile:
Expand Down