Fix trailing slash issue, leave legacy broken one on server until Noob updates again

This commit is contained in:
Andrew Grant committed 2021-01-08 20:42:19 -05:00
1 parent f2c93edcb4
commit 3fc5d1502e
2 files changed
+3 -3

No files matched your search

+2 -3
View File
@@ -66,8 +66,7 @@ def pathjoin(*args):
# Join a set of URL paths while maintaining the correct # Join a set of URL paths while maintaining the correct
# format of "/"'s between each part of the URL's pathway # format of "/"'s between each part of the URL's pathway
args = [f.lstrip("/").rstrip("/") for f in args] return '/'.join([f.lstrip('/').rstrip('/') for f in args]) + '/'
return "/".join(args) + "/"
def savedEngineName(sha256, network256): def savedEngineName(sha256, network256):
if not network256: return sha256 if not network256: return sha256
@@ -265,7 +264,7 @@ def getNetworkWeights(server, network):
print ('Fetching and Verifying Network ({0})'.format(network)) print ('Fetching and Verifying Network ({0})'.format(network))
fname = pathjoin('Networks', network).rstrip('/') fname = pathjoin('Networks', network).rstrip('/')
if not os.path.isfile(fname): if not os.path.isfile(fname):
getFile('{}/networks/download/{}'.format(server, network), fname) getFile(pathjoin(server, 'networks', 'download', network), fname)
with open(fname, 'rb') as weights: with open(fname, 'rb') as weights:
sha256 = hashlib.sha256(weights.read()).hexdigest()[:8].upper() sha256 = hashlib.sha256(weights.read()).hexdigest()[:8].upper()
+1
View File
@@ -53,6 +53,7 @@ urlpatterns = [
django.urls.path(r'networks/', OpenBench.views.networks), django.urls.path(r'networks/', OpenBench.views.networks),
django.urls.path(r'networks/<str:action>/', OpenBench.views.networks), django.urls.path(r'networks/<str:action>/', OpenBench.views.networks),
django.urls.path(r'networks/<str:action>/<str:sha256>', OpenBench.views.networks), django.urls.path(r'networks/<str:action>/<str:sha256>', OpenBench.views.networks),
django.urls.path(r'networks/<str:action>/<str:sha256>/', OpenBench.views.networks),
# Links for the Client to work with the Server # Links for the Client to work with the Server
django.urls.path(r'clientGetFiles/', OpenBench.views.clientGetFiles), django.urls.path(r'clientGetFiles/', OpenBench.views.clientGetFiles),