main
Bob Mottram 2020-07-08 16:17:00 +01:00
parent b02ddbaed0
commit db64ceb87d
5 changed files with 13 additions and 17 deletions

View File

@ -10,7 +10,6 @@ import base64
import hashlib
import binascii
import os
import random
import secrets

View File

@ -153,16 +153,14 @@ def randomizeActorImages(personJson: {}) -> None:
existingExtension = lastPartOfFilename.split('.')[1]
# NOTE: these files don't need to have cryptographically
# secure names
randStr = str(randint(10000000000000, 99999999999999)) # nosec
personJson['icon']['url'] = \
personId + '/avatar' + \
str(randint(10000000000000, 99999999999999)) + \ # nosec
'.' + existingExtension
personId + '/avatar' + randStr + '.' + existingExtension
lastPartOfFilename = personJson['image']['url'].split('/')[-1]
existingExtension = lastPartOfFilename.split('.')[1]
randStr = str(randint(10000000000000, 99999999999999)) # nosec
personJson['image']['url'] = \
personId + '/image' + \
str(randint(10000000000000, 99999999999999)) + \ # nosec
'.' + existingExtension
personId + '/image' + randStr + '.' + existingExtension
def createPersonBase(baseDir: str, nickname: str, domain: str, port: int,

View File

@ -1099,8 +1099,7 @@ def siteIsActive(url: str) -> bool:
return False
try:
req = urllib.request.Request(url)
with urllib.request.urlopen(req, timeout=10) as res: # nosec
# testStr = response.read()
urllib.request.urlopen(req, timeout=10) # nosec
return True
except SocketError as e:
if e.errno == errno.ECONNRESET: