catch maxpath error in mediasrv
https://anki.tenderapp.com/discussions/ankidesktop/30729-valueerror-in-ospathisdir-call-in-mediasrvpy-for-elements-with-long-strings-as-src
This commit is contained in:
parent
7f85218b5a
commit
6e95d9a398
@ -82,9 +82,17 @@ class RequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||
def send_head(self):
|
||||
path = self.translate_path(self.path)
|
||||
path = self._redirectWebExports(path)
|
||||
if os.path.isdir(path):
|
||||
try:
|
||||
isdir = os.path.isdir(path)
|
||||
except ValueError:
|
||||
# path too long exception on Windows
|
||||
self.send_error(HTTPStatus.NOT_FOUND, "File not found")
|
||||
return None
|
||||
|
||||
if isdir:
|
||||
self.send_error(HTTPStatus.NOT_FOUND, "File not found")
|
||||
return None
|
||||
|
||||
ctype = self.guess_type(path)
|
||||
try:
|
||||
f = open(path, 'rb')
|
||||
|
Loading…
Reference in New Issue
Block a user