diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py
index 11646711..5ce6ec4e 100644
--- a/copyparty/httpcli.py
+++ b/copyparty/httpcli.py
@@ -256,7 +256,7 @@ class HttpCli(object):
raise Pebkac(400, "folders verboten")
# up2k-php compat
- for k in "/chunkpit.php", "/handshake.php":
+ for k in "chunkpit.php", "handshake.php":
if self.vpath.endswith(k):
self.vpath = self.vpath[: -len(k)]
diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js
index 9806c64d..31ea64aa 100644
--- a/copyparty/web/up2k.js
+++ b/copyparty/web/up2k.js
@@ -95,12 +95,14 @@ function up2k_init(have_crypto) {
}
var post_url = o('bup').getElementsByTagName('form')[0].getAttribute('action');
+ if (post_url && post_url.charAt(post_url.length - 1) !== '/')
+ post_url += '/';
var shame = 'your browser disables sha512 unless you use https'
var is_https = (window.location + '').indexOf('https:') === 0;
if (is_https)
// chrome<37 firefox<34 edge<12 ie<11 opera<24 safari<10.1
- shame = 'your browser is impressively ancient'
+ shame = 'your browser is impressively ancient';
// upload ui hidden by default, clicking the header shows it
o('u2tgl').onclick = function (e) {
@@ -675,7 +677,7 @@ function up2k_init(have_crypto) {
(xhr.responseText && xhr.responseText) ||
"no further information"));
};
- xhr.open('POST', post_url + '/handshake.php', true);
+ xhr.open('POST', post_url + 'handshake.php', true);
xhr.responseType = 'text';
xhr.send(JSON.stringify({
"name": t.name,
@@ -735,7 +737,7 @@ function up2k_init(have_crypto) {
(xhr.responseText && xhr.responseText) ||
"no further information"));
};
- xhr.open('POST', post_url + '/chunkpit.php', true);
+ xhr.open('POST', post_url + 'chunkpit.php', true);
//xhr.setRequestHeader("X-Up2k-Hash", t.hash[npart].substr(1) + "x");
xhr.setRequestHeader("X-Up2k-Hash", t.hash[npart]);
xhr.setRequestHeader("X-Up2k-Wark", t.wark);