# HG changeset patch # User Nicholas Jillings # Date 1505391051 -3600 # Node ID 8805556c0f42755f47ec6afd68b7b2b6ef6bb1d3 # Parent 5d7e33fd00d84d4ce090f9792500ae1519a282e8 Potential fix for #235 diff -r 5d7e33fd00d8 -r 8805556c0f42 js/core.js --- a/js/core.js Tue Sep 12 19:22:21 2017 +0100 +++ b/js/core.js Thu Sep 14 13:10:51 2017 +0100 @@ -3591,7 +3591,7 @@ returnURL = specification.projectReturn; } } - this.request.open("GET", returnURL + "php/requestKey.php", true); + this.request.open("GET", returnURL + "php/requestKey.php?saveFilenamePrefix=" + this.parent.filenamePrefix, true); this.request.addEventListener("load", this); this.request.send(); }, diff -r 5d7e33fd00d8 -r 8805556c0f42 php/requestKey.php --- a/php/requestKey.php Tue Sep 12 19:22:21 2017 +0100 +++ b/php/requestKey.php Thu Sep 14 13:10:51 2017 +0100 @@ -17,6 +17,13 @@ header("Pragma: no-cache"); // Get the current test URL +// Load up the parameters +$saveFilenamePrefix = ''; +if (isset($_GET['saveFilenamePrefix'])) { + $saveFilenamePrefix = $_GET['saveFilenamePrefix'].'-'; +} else { + $saveFilenamePrefix = "save-"; +} $testURL = ""; if (isset($_GET['url'])) { $testURL = "../".$_GET["url"]; @@ -47,7 +54,7 @@ } } -$filename = "../saves/save-".$key.".xml"; +$filename = "../saves/".$saveFilenamePrefix.$key.".xml"; $fileHandle = fopen($filename, 'w'); if ($fileHandle == FALSE) { die("ERROR".$key."Could not open file for writing"); diff -r 5d7e33fd00d8 -r 8805556c0f42 python/pythonServer.py --- a/python/pythonServer.py Tue Sep 12 19:22:21 2017 +0100 +++ b/python/pythonServer.py Thu Sep 14 13:10:51 2017 +0100 @@ -120,6 +120,14 @@ tempKey = ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(32)); if (os.path.isfile("saves/save-"+tempKey+".xml") == False): key = tempKey + options = s.path.rsplit('?') + options = options[1].rsplit('&') + for option in options: + optionPair = option.rsplit('=') + if optionPair[0] == "saveFilenamePrefix": + prefix = optionPair[1] + if prefix == None: + prefix = "save" s.send_response(200) s.send_header("Content-type", "application/xml"); s.end_headers() @@ -128,7 +136,7 @@ s.wfile.write(reply) elif sys.version_info[0] == 3: s.wfile.write(bytes(reply, "utf-8")) - file = open("../saves/save-"+key+".xml",'w') + file = open("../saves/"+prefix+"-"+key+".xml",'w') file.write("") file.close()